'); notice = notice.replace("{browser_name}", (this.browser + " " + this.browserVersion)); code += '
' + title + '
' + notice + '
' + selectBrowser + '
'; if(supportedBrowsers.length > 0){ browsersList = supportedBrowsers; } else { browsersList = this.supportedBrowsers; } code += '=0)){return o}else{if((a9<=360)&&(a9>=315)){return o}else{if((a9>=135)&&(a9<=225)){return n}else{if((a9>45)&&(a9<135)){return v}else{return d}}}}}function ao(){var a7=new Date();return a7.getTime()}function aU(a7){a7=e(a7);var a9=a7.offset();var a8={left:a9.left,right:a9.left+a7.outerWidth(),top:a9.top,bottom:a9.top+a7.outerHeight()};return a8}function B(a7,a8){return(a7.x>a8.left&&a7.xa8.top&&a7.y e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this); /* * jQuery mmenu v4.1.3 * @requires jQuery 1.7.0 or later * * mmenu.frebsite.nl * * Copyright (c) Fred Heusschen * www.frebsite.nl * * Dual licensed under the MIT and GPL licenses. * http://en.wikipedia.org/wiki/MIT_License * http://en.wikipedia.org/wiki/GNU_General_Public_License * Updated: 2013-12-?? Added bootstrap_compat boolean to strip conflicting bootstrap classes from cloned menu * Updated: 2014-01-13 Added bootstrap_classes option for adding class names to menu such as visible-xs * Updated: 2014-01-23 Added ability to change subtitle_text (the back link at the top of the submenu) * Updated: 2014-01-31 Mika added 'open' class so links and arrow both open subnav * Updated: 2014-01-31 Mika added subnav locking using 'active' class, which can be added to an during setup * Updated: 2014-02-20 Mat added 'subnavLockingEnable' boolean option to disable subnav locking where required. * Updated: 2019-02-06 Matt added acessibility attributes (ARIA) to certain elements * Updated: 2019-04-08 Matt added acessibility attributes (ARIA) to submenu indicators and cloned for tags for sidebar menus */ (function( $ ) { var _PLUGIN_ = 'mmenu', _VERSION_ = '4.1.3'; // Plugin already excists if ( $[ _PLUGIN_ ] ) { return; } // Global variables var glbl = { $wndw: null, $html: null, $body: null, $page: null, $blck: null, $original_menu: null, $allMenus: null, $scrollTopNode: null }; var _c = {}, _e = {}, _d = {}, _serialnr = 0; $[ _PLUGIN_ ] = function( $menu, opts, conf ) { glbl.$allMenus = glbl.$allMenus.add( $menu ); this.$menu = $menu; this.opts = opts; this.conf = conf; this.serialnr = _serialnr++; this._init(); return this; }; $[ _PLUGIN_ ].prototype = { open: function() { this._openSetup(); this._openFinish(); return 'open'; }, _openSetup: function() { // Find scrolltop var _scrollTop = findScrollTop(); // Set opened this.$menu.addClass( _c.current ); // Close others glbl.$allMenus.not( this.$menu ).trigger( _e.close ); // Store style and position glbl.$page .data( _d.style, glbl.$page.attr( 'style' ) || '' ) .data( _d.scrollTop, _scrollTop ) .data( _d.offetLeft, glbl.$page.offset().left ); // Resize page to window width var _w = 0; glbl.$wndw .off( _e.resize ) .on( _e.resize, function( e, force ) { if ( force || glbl.$html.hasClass( _c.opened ) ) { var nw = glbl.$wndw.width(); if ( nw != _w ) { _w = nw; glbl.$page.width( nw - glbl.$page.data( _d.offetLeft ) ); } } } ) .trigger( _e.resize, [ true ] ); // Prevent tabbing out of the menu if ( this.conf.preventTabbing ) { glbl.$wndw .off( _e.keydown ) .on( _e.keydown, function( e ) { if ( e.keyCode == 9 ) { e.preventDefault(); return false; } } ); } // Add options if ( this.opts.modal ) { glbl.$html.addClass( _c.modal ); } if ( this.opts.moveBackground ) { glbl.$html.addClass( _c.background ); } if ( this.opts.position != 'left' ) { glbl.$html.addClass( _c.mm( this.opts.position ) ); } if ( this.opts.position == 'relative' ) { glbl.$html.addClass( _c.relative ); } if ( this.opts.zposition != 'back' ) { glbl.$html.addClass( _c.mm( this.opts.zposition ) ); } if ( this.opts.classes ) { glbl.$html.addClass( this.opts.classes ); } // Open glbl.$html.addClass( _c.opened ); this.$menu.addClass( _c.opened ); // Scroll page to scrolltop glbl.$page.scrollTop( _scrollTop ); // Scroll menu to top this.$menu.scrollTop( 0 ); }, _openFinish: function() { var that = this; // Callback transitionend( glbl.$page, function() { that.$menu.trigger( _e.opened ); }, this.conf.transitionDuration ); // Opening glbl.$html.addClass( _c.opening ); this.$menu.trigger( _e.opening ); // Scroll window to top window.scrollTo( 0, 1 ); // Reset Padding if ( that.opts.position == 'relative' ) { $original_menu.parent().css("margin-bottom", '0px' ); // Open menu var id = this.$menu.attr( 'id' ); if ( id && id.length ) { if ( this.conf.clone ) { id = _c.umm( id ); } if ( this.conf.bootstrap_classes ) { this.$menu.addClass(this.conf.bootstrap_classes); } $('a[href="#' + id + '"]') .off( _e.click ) .on( _e.click, function( e ) { e.preventDefault(); that.$menu.trigger( _e.close ); } ); } } /** * Accessibility Features * **/ // Set aria-expanded to true var target_id = this.$menu.attr( 'id' ).replace('mm-', ''); $('a[href="#' + target_id + '"]').attr('aria-expanded', true); //focus on the first navlink in the expanded menu this.$menu.find('ul:first>li:first-child>a').focus(); }, close: function() { var that = this; // Callback transitionend( glbl.$page, function() { that.$menu .removeClass( _c.current ) .removeClass( _c.opened ); glbl.$html .removeClass( _c.opened ) .removeClass( _c.modal ) .removeClass( _c.background ) .removeClass( _c.mm( that.opts.position ) ) .removeClass( _c.mm( that.opts.zposition ) ); if ( that.opts.classes ) { glbl.$html.removeClass( that.opts.classes ); } glbl.$wndw .off( _e.resize ) .off( _e.keydown ); // Restore style and position glbl.$page.attr( 'style', glbl.$page.data( _d.style ) ); if ( glbl.$scrollTopNode ) { glbl.$scrollTopNode.scrollTop( glbl.$page.data( _d.scrollTop ) ); } // Closed that.$menu.trigger( _e.closed ); if ( that.opts.position == 'relative' ) { $original_menu.parent().css("margin-bottom", that.$menu.css( 'margin-bottom') ); // Open menu var id = that.$menu.attr( 'id' ); if ( id && id.length ) { if ( that.conf.clone ) { id = _c.umm( id ); } $('a[href="#' + id + '"]') .off( _e.click ) .on( _e.click, function( e ) { e.preventDefault(); that.$menu.trigger( _e.open ); } ); } } }, that.conf.transitionDuration ); // Closing glbl.$html.removeClass( _c.opening ); this.$menu.trigger( _e.closing ); /** * Accessibility Features * **/ // Set focus back to nav-toggle var target_id = this.$menu.attr( 'id' ).replace('mm-', ''); var $target = $('a[href="#' + target_id + '"]'); // Set aria-expanded to true $target.attr('aria-expanded', false); //focus on the first navlink in the expanded menu $target.focus(); return 'close'; }, _init: function() { this.opts = extendOptions( this.opts, this.conf, this.$menu ); this.direction = ( this.opts.slidingSubmenus ) ? 'horizontal' : 'vertical'; // INIT PAGE & MENU this._initPage( glbl.$page ); this._initMenu(); if ( this.opts.position != 'relative' ) { this._initBlocker(); } this._initPanles(); this._initLinks(); this._initOpenClose(); this._bindCustomEvents(); if ( $[ _PLUGIN_ ].addons ) { for ( var a = 0; a < $[ _PLUGIN_ ].addons.length; a++ ) { if ( typeof this[ '_addon_' + $[ _PLUGIN_ ].addons[ a ] ] == 'function' ) { this[ '_addon_' + $[ _PLUGIN_ ].addons[ a ] ](); } } } }, _bindCustomEvents: function() { var that = this; this.$menu .off( _e.open + ' ' + _e.close + ' ' + _e.setPage+ ' ' + _e.update ) .on( _e.open + ' ' + _e.close + ' ' + _e.setPage+ ' ' + _e.update, function( e ) { e.stopPropagation(); } ); // Menu-events this.$menu .on( _e.open, function( e ) { if ( $(this).hasClass( _c.current ) ) { e.stopImmediatePropagation(); return false; } return that.open(); } ) .on( _e.close, function( e ) { if ( !$(this).hasClass( _c.current ) ) { e.stopImmediatePropagation(); return false; } return that.close(); } ) .on( _e.setPage, function( e, $p ) { that._initPage( $p ); that._initOpenClose(); } ); // Panel-events var $panels = this.$menu.find( this.opts.isMenu && this.direction != 'horizontal' ? 'ul, ol' : '.' + _c.panel ); $panels .off( _e.toggle + ' ' + _e.open + ' ' + _e.close ) .on( _e.toggle + ' ' + _e.open + ' ' + _e.close, function( e ) { e.stopPropagation(); } ); if ( this.direction == 'horizontal' ) { $panels .on( _e.open, function( e ) { return openSubmenuHorizontal( $(this), that.$menu ); } ); } else { $panels .on( _e.toggle, function( e ) { var $t = $(this); return $t.triggerHandler( $t.parent().hasClass( _c.opened ) ? _e.close : _e.open ); } ) .on( _e.open, function( e ) { $(this).parent().addClass( _c.opened ); return 'open'; } ) .on( _e.close, function( e ) { $(this).parent().removeClass( _c.opened ); return 'close'; } ); } }, _initBlocker: function() { var that = this; if ( !glbl.$blck ) { glbl.$blck = $( '' ).appendTo( glbl.$body ); } glbl.$blck .off( _e.touchstart ) .on( _e.touchstart, function( e ) { e.preventDefault(); e.stopPropagation(); glbl.$blck.trigger( _e.mousedown ); } ) .on( _e.mousedown, function( e ) { e.preventDefault(); if ( !glbl.$html.hasClass( _c.modal ) ) { that.$menu.trigger( _e.close ); } } ); }, _initPage: function( $p ) { if ( !$p ) { $p = $(this.conf.pageSelector, glbl.$body); if ( $p.length > 1 ) { $[ _PLUGIN_ ].debug( 'Multiple nodes found for the page-node, all nodes are wrapped in one <' + this.conf.pageNodetype + '>.' ); $p = $p.wrapAll( '<' + this.conf.pageNodetype + ' />' ).parent(); } } $p.addClass( _c.page ); glbl.$page = $p; }, _initMenu: function() { var that = this; // Clone if needed if ( this.conf.clone ) { $original_menu = this.$menu; this.$menu = this.$menu.clone( true ); this.$menu.add( this.$menu.find( '*' ) ).filter( '[id]' ).each( function() { $(this).attr( 'id', _c.mm( $(this).attr( 'id' ) ) ); // updated by matt 4/8/19 for ADA compliance // allows the for attribute to be cloned to sidebar mobile menus $(this).attr( 'for', _c.mm( $(this).attr( 'for' ) ) ); } ); } // Strip conflicting bootstrap nav classes if ( this.conf.bootstrap_compat ) { var bs_classes = 'nav navbar navbar-nav navbar-default navbar-static-top dropdown-menu collapse navbar-collapse navbar-form navbar-right hidden-sm hidden-md hidden-lg'; this.$menu.removeClass(bs_classes); this.$menu.find("*").each( function() { $(this).removeClass(bs_classes); if( $(this).hasClass('caret') ) { $(this).remove(); } } ); } // Strip whitespace this.$menu.contents().each( function() { if ( $(this)[ 0 ].nodeType == 3 ) { $(this).remove(); } } ); // Prepend to body if ( this.opts.position == 'relative' ) { this.$menu.addClass( _c.menu ); (this.opts.positionAfter) ? $(this.opts.positionAfter).after(this.$menu) : original_object.after(this.$menu); // Set bottom padding of menu to match previous sibling padding/margin this.$menu.css("margin-bottom", $original_menu.parent().css( 'margin-bottom') ); } else { this.$menu .prependTo( 'body' ) .addClass( _c.menu ); } // Add direction class this.$menu.addClass( _c.mm( this.direction ) ); // Add options classes if ( this.opts.classes ) { this.$menu.addClass( this.opts.classes ); } if ( this.opts.isMenu ) { this.$menu.addClass( _c.ismenu ); } if ( this.opts.position != 'left' ) { this.$menu.addClass( _c.mm( this.opts.position ) ); } if ( this.opts.zposition != 'back' ) { this.$menu.addClass( _c.mm( this.opts.zposition ) ); } // set menu //this.$menu }, _initPanles: function() { var that = this; // Refactor List class this.__refactorClass( $('.' + this.conf.listClass, this.$menu), 'list' ); // Add List class if ( this.opts.isMenu ) { $('ul, ol', this.$menu) .not( '.mm-nolist' ) .addClass( _c.list ); } var $lis = $('.' + _c.list + ' > li', this.$menu); // Refactor Selected class this.__refactorClass( $lis.filter( '.' + this.conf.selectedClass ), 'selected' ); // Refactor Label class this.__refactorClass( $lis.filter( '.' + this.conf.labelClass ), 'label' ); // Refactor Spacer class this.__refactorClass( $lis.filter( '.' + this.conf.spacerClass ), 'spacer' ); // setSelected-event $lis .off( _e.setSelected ) .on( _e.setSelected, function( e, selected ) { e.stopPropagation(); $lis.removeClass( _c.selected ); if ( typeof selected != 'boolean' ) { selected = true; } if ( selected ) { $(this).addClass( _c.selected ); } } ); // Refactor Panel class this.__refactorClass( $('.' + this.conf.panelClass, this.$menu), 'panel' ); // Add Panel class this.$menu .children() .filter( this.conf.panelNodetype ) .add( this.$menu.find( '.' + _c.list ).children().children().filter( this.conf.panelNodetype ) ) .addClass( _c.panel ); var $panels = $('.' + _c.panel, this.$menu); // Add an ID to all panels $panels .each( function( i ) { var $t = $(this), id = $t.attr( 'id' ) || _c.mm( 'm' + that.serialnr + '-p' + i ); $t.attr( 'id', id ); } ); // Add open and close links to menu items mm-panel $panels .find( '.' + _c.panel ) .each( function( i ) { var $t = $(this), $u = $t.is( 'ul, ol' ) ? $t : $t.find( 'ul ,ol' ).first(), $l = $t.parent(), $a = $l.find( '> a, > span' ), $p = $l.closest( '.' + _c.panel ); $t.data( _d.parent, $l ); if ( $l.parent().is( '.' + _c.list ) ) { // change by mika 1/31/14 // updated by matt 4/8/19 for ADA compliance $a.addClass(_c.open).attr( 'href', '#'+$t.attr( 'id' ) ).attr('aria-label', 'Submenu Open'); var $btn = $( '' ).insertBefore( $a ); if ( !$a.is( 'a' ) ) { $btn.addClass( _c.fullsubopen ); } if ( that.direction == 'horizontal' ) { $u.prepend( ' ' + (that.opts.subtitle_text != '' ? that.opts.subtitle_text : $a.text()) + ' ' ); } } } ); // Link anchors to panels var evt = this.direction == 'horizontal' ? _e.open : _e.toggle; $panels .each( function( i ) { var $opening = $(this), id = $opening.attr( 'id' ); $('a[href="#' + id + '"]', that.$menu) .off( _e.click ) .on( _e.click, function( e ) { e.preventDefault(); $opening.trigger( evt ); } ); } ); if ( this.direction == 'horizontal' ) { // Add opened-classes var $selected = $('.' + _c.list + ' > li.' + _c.selected, this.$menu); $selected .add( $selected.parents( 'li' ) ) .parents( 'li' ).removeClass( _c.selected ) .end().each( function() { var $t = $(this), $u = $t.find( '> .' + _c.panel ); if ( $u.length ) { $t.parents( '.' + _c.panel ).addClass( _c.subopened ); $u.addClass( _c.opened ); } } ) .closest( '.' + _c.panel ).addClass( _c.opened ) .parents( '.' + _c.panel ).addClass( _c.subopened ); } else { // Replace Selected-class with opened-class in parents from .Selected $('li.' + _c.selected, this.$menu) .addClass( _c.opened ) .parents( '.' + _c.selected ).removeClass( _c.selected ); } // Set current opened var $current = $panels.filter( '.' + _c.opened ); if ( !$current.length ) { // test for active li element if(this.conf.subnavLockingEnable) { $current = $panels.find('li.active:last').first().parent(); } if ( !$current.length ) { $current = $panels.first(); } } $current .addClass( _c.opened ) .last() .addClass( _c.current ); // Rearrange markup if ( this.direction == 'horizontal' ) { $panels.find( '.' + _c.panel ).appendTo( this.$menu ); } }, _initLinks: function() { var that = this; $('.' + _c.list + ' > li > a', this.$menu) .not( '.' + _c.open ) .not( '.' + _c.subopen ) .not( '.' + _c.subclose ) .not( '[rel="external"]' ) .not( '[target="_blank"]' ) .off( _e.click ) .on( _e.click, function( e ) { var $t = $(this), href = $t.attr( 'href' ); // Set selected item if ( that.__valueOrFn( that.opts.onClick.setSelected, $t ) ) { $t.parent().trigger( _e.setSelected ); } // Prevent default / don't follow link. Default: false var preventDefault = that.__valueOrFn( that.opts.onClick.preventDefault, $t, href.slice( 0, 1 ) == '#' ); if ( preventDefault ) { e.preventDefault(); } // Block UI. Default: false if preventDefault, true otherwise if ( that.__valueOrFn( that.opts.onClick.blockUI, $t, !preventDefault ) ) { glbl.$html.addClass( _c.blocking ); } // Close menu. Default: true if preventDefault, false otherwise if ( that.__valueOrFn( that.opts.onClick.close, $t, preventDefault ) ) { that.$menu.triggerHandler( _e.close ); } } ); }, _initOpenClose: function() { var that = this; // Open menu var id = this.$menu.attr( 'id' ); if ( id && id.length ) { if ( this.conf.clone ) { id = _c.umm( id ); } $('a[href="#' + id + '"]') .off( _e.click ) .on( _e.click, function( e ) { e.preventDefault(); that.$menu.trigger( _e.open ); } ); } // Close menu var id = glbl.$page.attr( 'id' ); if ( id && id.length ) { $('a[href="#' + id + '"]') .off( _e.click ) .on( _e.click, function( e ) { e.preventDefault(); that.$menu.trigger( _e.close ); } ); } }, __valueOrFn: function( o, $e, d ) { if ( typeof o == 'function' ) { return o.call( $e[ 0 ] ); } if ( typeof o == 'undefined' && typeof d != 'undefined' ) { return d; } return o; }, __refactorClass: function( $e, c ) { $e.removeClass( this.conf[ c + 'Class' ] ).addClass( _c[ c ] ); } }; $.fn[ _PLUGIN_ ] = function( opts, conf ) { // First time plugin is fired if ( !glbl.$wndw ) { _initPlugin(); } // Extend options opts = extendOptions( opts, conf ); conf = extendConfiguration( conf ); return this.each( function() { var $menu = $(this); if ( $menu.data( _PLUGIN_ ) ) { return; } $menu.data( _PLUGIN_, new $[ _PLUGIN_ ]( $menu, opts, conf ) ); } ); }; $[ _PLUGIN_ ].version = _VERSION_; $[ _PLUGIN_ ].defaults = { position : 'left', positionAfter : '', subtitle_text: '', zposition : 'back', moveBackground : true, slidingSubmenus : true, modal : false, classes : '', onClick : { // close : true, // blockUI : null, // preventDefault : null, setSelected : true } }; $[ _PLUGIN_ ].configuration = { preventTabbing : true, panelClass : 'Panel', listClass : 'List', selectedClass : 'Selected', labelClass : 'Label', spacerClass : 'Spacer', pageNodetype : 'div', panelNodetype : 'ul, ol, div', transitionDuration : 400, subnavLockingEnable : true }; /* SUPPORT */ (function() { var wd = window.document, ua = window.navigator.userAgent; var _touch = 'ontouchstart' in wd, _overflowscrolling = 'WebkitOverflowScrolling' in wd.documentElement.style, _transition = (function() { var s = document.createElement( 'div' ).style; if ( 'webkitTransition' in s ) { return 'webkitTransition'; } return 'transition' in s; })(), _oldAndroidBrowser = (function() { if ( ua.indexOf( 'Android' ) >= 0 ) { return 2.4 > parseFloat( ua.slice( ua.indexOf( 'Android' ) +8 ) ); } return false; })(); $[ _PLUGIN_ ].support = { touch: _touch, transition: _transition, oldAndroidBrowser: _oldAndroidBrowser, overflowscrolling: (function() { if ( !_touch ) { return true; } if ( _overflowscrolling ) { return true; } if ( _oldAndroidBrowser ) { return false; } return true; })() }; })(); /* BROWSER SPECIFIC FIXES */ $[ _PLUGIN_ ].useOverflowScrollingFallback = function( use ) { if ( glbl.$html ) { if ( typeof use == 'boolean' ) { glbl.$html[ use ? 'addClass' : 'removeClass' ]( _c.nooverflowscrolling ); } return glbl.$html.hasClass( _c.nooverflowscrolling ); } else { _useOverflowScrollingFallback = use; return use; } }; /* DEBUG */ $[ _PLUGIN_ ].debug = function( msg ) {}; $[ _PLUGIN_ ].deprecated = function( depr, repl ) { if ( typeof console != 'undefined' && typeof console.warn != 'undefined' ) { console.warn( 'MMENU: ' + depr + ' is deprecated, use ' + repl + ' instead.' ); } }; // Global vars var _useOverflowScrollingFallback = !$[ _PLUGIN_ ].support.overflowscrolling; function extendOptions( o, c, $m ) { if ( typeof o != 'object' ) { o = {}; } if ( $m ) { if ( typeof o.isMenu != 'boolean' ) { var $c = $m.children(); o.isMenu = ( $c.length == 1 && $c.is( c.panelNodetype ) ); } return o; } // Extend onClick if ( typeof o.onClick != 'object' ) { o.onClick = {}; } // DEPRECATED if ( typeof o.onClick.setLocationHref != 'undefined' ) { $[ _PLUGIN_ ].deprecated( 'onClick.setLocationHref option', '!onClick.preventDefault' ); if ( typeof o.onClick.setLocationHref == 'boolean' ) { o.onClick.preventDefault = !o.onClick.setLocationHref; } } // /DEPRECATED // Extend from defaults o = $.extend( true, {}, $[ _PLUGIN_ ].defaults, o ); // Degration if ( $[ _PLUGIN_ ].useOverflowScrollingFallback() ) { switch( o.position ) { case 'top': case 'relative': case 'right': case 'bottom': $[ _PLUGIN_ ].debug( 'position: "' + o.position + '" not supported when using the overflowScrolling-fallback.' ); o.position = 'left'; break; } switch( o.zposition ) { case 'front': case 'next': $[ _PLUGIN_ ].debug( 'z-position: "' + o.zposition + '" not supported when using the overflowScrolling-fallback.' ); o.zposition = 'back'; break; } } return o; } function extendConfiguration( c ) { if ( typeof c != 'object' ) { c = {}; } // DEPRECATED if ( typeof c.panelNodeType != 'undefined' ) { $[ _PLUGIN_ ].deprecated( 'panelNodeType configuration option', 'panelNodetype' ); c.panelNodetype = c.panelNodeType; } // /DEPRECATED c = $.extend( true, {}, $[ _PLUGIN_ ].configuration, c ) // Set pageSelector if ( typeof c.pageSelector != 'string' ) { c.pageSelector = '> ' + c.pageNodetype; } return c; } function _initPlugin() { glbl.$wndw = $(window); glbl.$html = $('html'); glbl.$body = $('body'); glbl.$allMenus = $(); // Classnames, Datanames, Eventnames $.each( [ _c, _d, _e ], function( i, o ) { o.add = function( c ) { c = c.split( ' ' ); for ( var d in c ) { o[ c[ d ] ] = o.mm( c[ d ] ); } }; } ); // Classnames _c.mm = function( c ) { return 'mm-' + c; }; _c.add( 'menu ismenu panel list subtitle selected label spacer current highest hidden page relative blocker modal background opened opening subopened subopen open fullsubopen subclose nooverflowscrolling' ); _c.umm = function( c ) { if ( c.slice( 0, 3 ) == 'mm-' ) { c = c.slice( 3 ); } return c; }; // Datanames _d.mm = function( d ) { return 'mm-' + d; }; _d.add( 'parent style scrollTop offetLeft' ); // Eventnames _e.mm = function( e ) { return e + '.mm'; }; _e.add( 'toggle open opening opened close closing closed update setPage setSelected transitionend touchstart touchend mousedown mouseup click keydown keyup resize' ); $[ _PLUGIN_ ]._c = _c; $[ _PLUGIN_ ]._d = _d; $[ _PLUGIN_ ]._e = _e; $[ _PLUGIN_ ].glbl = glbl; $[ _PLUGIN_ ].useOverflowScrollingFallback( _useOverflowScrollingFallback ); } function openSubmenuHorizontal( $opening, $m ) { if ( $opening.hasClass( _c.current ) ) { return false; } var $panels = $('.' + _c.panel, $m), $current = $panels.filter( '.' + _c.current ); $panels .removeClass( _c.highest ) .removeClass( _c.current ) .not( $opening ) .not( $current ) .addClass( _c.hidden ); if ( $opening.hasClass( _c.opened ) ) { $current .addClass( _c.highest ) .removeClass( _c.opened ) .removeClass( _c.subopened ); } else { $opening .addClass( _c.highest ); $current .addClass( _c.subopened ); } $opening .removeClass( _c.hidden ) .removeClass( _c.subopened ) .addClass( _c.current ) .addClass( _c.opened ); return 'open'; } function findScrollTop() { if ( !glbl.$scrollTopNode ) { if ( glbl.$html.scrollTop() != 0 ) { glbl.$scrollTopNode = glbl.$html; } else if ( glbl.$body.scrollTop() != 0 ) { glbl.$scrollTopNode = glbl.$body; } } return ( glbl.$scrollTopNode ) ? glbl.$scrollTopNode.scrollTop() : 0; } function transitionend( $e, fn, duration ) { var s = $[ _PLUGIN_ ].support.transition; if ( s == 'webkitTransition' ) { $e.one( 'webkitTransitionEnd', fn ); } else if ( s ) { $e.one( _e.transitionend, fn ); } else { setTimeout( fn, duration ); } } })( jQuery ); !function(e){"use strict" var s=function(){var s={bcClass:"sf-breadcrumb",menuClass:"sf-js-enabled",anchorClass:"sf-with-ul",menuArrowClass:"sf-arrows"},o=function(){var s=/iPhone|iPad|iPod/i.test(navigator.userAgent) return s&&e(window).load(function(){e("body").children().on("click",e.noop)}),s}(),n=function(){var e=document.documentElement.style return"behavior"in e&&"fill"in e&&/iemobile/i.test(navigator.userAgent)}(),t=function(e,o){var n=s.menuClass o.cssArrows&&(n+=" "+s.menuArrowClass),e.toggleClass(n)},i=function(o,n){return o.find("li."+n.pathClass).slice(0,n.pathLevels).addClass(n.hoverClass+" "+s.bcClass).filter(function(){return e(this).children(n.popUpSelector).hide().show().length}).removeClass(n.pathClass)},r=function(e){e.children("a").toggleClass(s.anchorClass)},a=function(e){var s=e.css("ms-touch-action") s="pan-y"===s?"auto":"pan-y",e.css("ms-touch-action",s)},l=function(s,t){var i="li:has("+t.popUpSelector+")" e.fn.hoverIntent&&!t.disableHI?s.hoverIntent(u,p,i):s.on("mouseenter.superfish",i,u).on("mouseleave.superfish",i,p) var r="MSPointerDown.superfish" o||(r+=" touchend.superfish"),n&&(r+=" mousedown.superfish"),s.on("focusin.superfish","li",u).on("focusout.superfish","li",p).on(r,"a",t,h)},h=function(s){var o=e(this),n=o.siblings(s.data.popUpSelector) n.length>0&&n.is(":hidden")&&(o.one("click.superfish",!1),"MSPointerDown"===s.type?o.trigger("focus"):e.proxy(u,o.parent("li"))())},u=function(){var s=e(this),o=d(s) clearTimeout(o.sfTimer),s.siblings().superfish("hide").end().superfish("show")},p=function(){var s=e(this),n=d(s) o?e.proxy(f,s,n)():(clearTimeout(n.sfTimer),n.sfTimer=setTimeout(e.proxy(f,s,n),n.delay))},f=function(s){s.retainPath=e.inArray(this[0],s.$path)>-1,this.superfish("hide"),this.parents("."+s.hoverClass).length||(s.onIdle.call(c(this)),s.$path.length&&e.proxy(u,s.$path)())},c=function(e){return e.closest("."+s.menuClass)},d=function(e){return c(e).data("sf-options")} return{hide:function(s){if(this.length){var o=this,n=d(o) if(!n)return this var t=n.retainPath===!0?n.$path:"",i=o.find("li."+n.hoverClass).add(this).not(t).removeClass(n.hoverClass).children(n.popUpSelector),r=n.speedOut s&&(i.show(),r=0),n.retainPath=!1,n.onBeforeHide.call(i),i.stop(!0,!0).animate(n.animationOut,r,function(){var s=e(this) n.onHide.call(s)})}return this},show:function(){var e=d(this) if(!e)return this var s=this.addClass(e.hoverClass),o=s.children(e.popUpSelector) return e.onBeforeShow.call(o),o.stop(!0,!0).animate(e.animation,e.speed,function(){e.onShow.call(o)}),this},destroy:function(){return this.each(function(){var o,n=e(this),i=n.data("sf-options") return i?(o=n.find(i.popUpSelector).parent("li"),clearTimeout(i.sfTimer),t(n,i),r(o),a(n),n.off(".superfish").off(".hoverIntent"),o.children(i.popUpSelector).attr("style",function(e,s){return s.replace(/display[^;]+;?/g,"")}),i.$path.removeClass(i.hoverClass+" "+s.bcClass).addClass(i.pathClass),n.find("."+i.hoverClass).removeClass(i.hoverClass),i.onDestroy.call(n),n.removeData("sf-options"),void 0):!1})},init:function(o){return this.each(function(){var n=e(this) if(n.data("sf-options"))return!1 var h=e.extend({},e.fn.superfish.defaults,o),u=n.find(h.popUpSelector).parent("li") h.$path=i(n,h),n.data("sf-options",h),t(n,h),r(u),a(n),l(n,h),u.not("."+s.bcClass).superfish("hide",!0),h.onInit.call(this)})}}}() e.fn.superfish=function(o){return s[o]?s[o].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof o&&o?e.error("Method "+o+" does not exist on jQuery.fn.superfish"):s.init.apply(this,arguments)},e.fn.superfish.defaults={popUpSelector:"ul,.sf-mega",hoverClass:"sfHover",pathClass:"overrideThisToUse",pathLevels:1,delay:800,animation:{opacity:"show"},animationOut:{opacity:"hide"},speed:"normal",speedOut:"fast",cssArrows:!0,disableHI:!1,onInit:e.noop,onBeforeShow:e.noop,onShow:e.noop,onBeforeHide:e.noop,onHide:e.noop,onIdle:e.noop,onDestroy:e.noop},e.fn.extend({hideSuperfishUl:s.hide,showSuperfishUl:s.show})}(jQuery); /*! * jQuery Cookie Plugin v1.3.1 * https://github.com/carhartl/jquery-cookie * * Copyright 2013 Klaus Hartl * Released under the MIT license */ (function(factory){if(typeof define==='function'&&define.amd){define(['jquery'],factory)}else{factory(jQuery)}}(function($){var pluses=/\+/g;function encode(s){return config.raw?s:encodeURIComponent(s)}function decode(s){return config.raw?s:decodeURIComponent(s)}function stringifyCookieValue(value){return encode(config.json?JSON.stringify(value):String(value))}function parseCookieValue(s){if(s.indexOf('"')===0){s=s.slice(1,-1).replace(/\\"/g, '"').replace(/\\\\/g,'\\');}try{s=decodeURIComponent(s.replace(pluses,' '));return config.json?JSON.parse(s):s}catch(e){}}function read(s,converter){var value=config.raw?s:parseCookieValue(s);return $.isFunction(converter)?converter(value):value}var config=$.cookie=function(key,value,options){if(value!==undefined&&!$.isFunction(value)){options=$.extend({},config.defaults,options);if(typeof options.expires==='number'){var days=options.expires,t=options.expires=new Date();t.setTime(+t+days * 864e+5)}return(document.cookie=[encode(key),'=',stringifyCookieValue(value),options.expires?'; expires='+options.expires.toUTCString():'',options.path?'; path='+options.path:'',options.domain?'; domain='+options.domain:'',options.secure?'; secure':''].join(''))}var result=key?undefined:{};var cookies=document.cookie?document.cookie.split('; '):[];for(var i=0,l=cookies.length;i=0)&&i(t,!s)}}),e("").outerWidth(1).jquery||e.each(["Width","Height"],function(i,n){function s(t,i,n,s){return e.each(a,function(){i-=parseFloat(e.css(t,"padding"+this))||0,n&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var a="Width"===n?["Left","Right"]:["Top","Bottom"],o=n.toLowerCase(),r={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+n]=function(i){return i===t?r["inner"+n].call(this):this.each(function(){e(this).css(o,s(this,i)+"px")})},e.fn["outer"+n]=function(t,i){return"number"!=typeof t?r["outer"+n].call(this,t):this.each(function(){e(this).css(o,s(this,t,!0,i)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.support.selectstart="onselectstart"in document.createElement("div"),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.extend(e.ui,{plugin:{add:function(t,i,n){var s,a=e.ui[t].prototype;for(s in n)a.plugins[s]=a.plugins[s]||[],a.plugins[s].push([i,n[s]])},call:function(e,t,i){var n,s=e.plugins[t];if(s&&e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType)for(n=0;s.length>n;n++)e.options[s[n][0]]&&s[n][1].apply(e.element,i)}},hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var n=i&&"left"===i?"scrollLeft":"scrollTop",s=!1;return t[n]>0?!0:(t[n]=1,s=t[n]>0,t[n]=0,s)}})})(jQuery);(function(t,e){var i=0,s=Array.prototype.slice,n=t.cleanData;t.cleanData=function(e){for(var i,s=0;null!=(i=e[s]);s++)try{t(i).triggerHandler("remove")}catch(o){}n(e)},t.widget=function(i,s,n){var o,a,r,h,l={},c=i.split(".")[0];i=i.split(".")[1],o=c+"-"+i,n||(n=s,s=t.Widget),t.expr[":"][o.toLowerCase()]=function(e){return!!t.data(e,o)},t[c]=t[c]||{},a=t[c][i],r=t[c][i]=function(t,i){return this._createWidget?(arguments.length&&this._createWidget(t,i),e):new r(t,i)},t.extend(r,a,{version:n.version,_proto:t.extend({},n),_childConstructors:[]}),h=new s,h.options=t.widget.extend({},h.options),t.each(n,function(i,n){return t.isFunction(n)?(l[i]=function(){var t=function(){return s.prototype[i].apply(this,arguments)},e=function(t){return s.prototype[i].apply(this,t)};return function(){var i,s=this._super,o=this._superApply;return this._super=t,this._superApply=e,i=n.apply(this,arguments),this._super=s,this._superApply=o,i}}(),e):(l[i]=n,e)}),r.prototype=t.widget.extend(h,{widgetEventPrefix:a?h.widgetEventPrefix||i:i},l,{constructor:r,namespace:c,widgetName:i,widgetFullName:o}),a?(t.each(a._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,r,i._proto)}),delete a._childConstructors):s._childConstructors.push(r),t.widget.bridge(i,r)},t.widget.extend=function(i){for(var n,o,a=s.call(arguments,1),r=0,h=a.length;h>r;r++)for(n in a[r])o=a[r][n],a[r].hasOwnProperty(n)&&o!==e&&(i[n]=t.isPlainObject(o)?t.isPlainObject(i[n])?t.widget.extend({},i[n],o):t.widget.extend({},o):o);return i},t.widget.bridge=function(i,n){var o=n.prototype.widgetFullName||i;t.fn[i]=function(a){var r="string"==typeof a,h=s.call(arguments,1),l=this;return a=!r&&h.length?t.widget.extend.apply(null,[a].concat(h)):a,r?this.each(function(){var s,n=t.data(this,o);return n?t.isFunction(n[a])&&"_"!==a.charAt(0)?(s=n[a].apply(n,h),s!==n&&s!==e?(l=s&&s.jquery?l.pushStack(s.get()):s,!1):e):t.error("no such method '"+a+"' for "+i+" widget instance"):t.error("cannot call methods on "+i+" prior to initialization; "+"attempted to call method '"+a+"'")}):this.each(function(){var e=t.data(this,o);e?e.option(a||{})._init():t.data(this,o,new n(a,this))}),l}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:" ",options:{disabled:!1,create:null},_createWidget:function(e,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this.bindings=t(),this.hoverable=t(),this.focusable=t(),s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:t.noop,_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(t.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:t.noop,widget:function(){return this.element},option:function(i,s){var n,o,a,r=i;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof i)if(r={},n=i.split("."),i=n.shift(),n.length){for(o=r[i]=t.widget.extend({},this.options[i]),a=0;n.length-1>a;a++)o[n[a]]=o[n[a]]||{},o=o[n[a]];if(i=n.pop(),1===arguments.length)return o[i]===e?null:o[i];o[i]=s}else{if(1===arguments.length)return this.options[i]===e?null:this.options[i];r[i]=s}return this._setOptions(r),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return this.options[t]=e,"disabled"===t&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!e).attr("aria-disabled",e),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(i,s,n){var o,a=this;"boolean"!=typeof i&&(n=s,s=i,i=!1),n?(s=o=t(s),this.bindings=this.bindings.add(s)):(n=s,s=this.element,o=this.widget()),t.each(n,function(n,r){function h(){return i||a.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof r?a[r]:r).apply(a,arguments):e}"string"!=typeof r&&(h.guid=r.guid=r.guid||h.guid||t.guid++);var l=n.match(/^(\w+)\s*(.*)$/),c=l[1]+a.eventNamespace,u=l[2];u?o.delegate(u,c,h):s.bind(c,h)})},_off:function(t,e){e=(e||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(e).undelegate(e)},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){t(e.currentTarget).addClass("ui-state-hover")},mouseleave:function(e){t(e.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){t(e.currentTarget).addClass("ui-state-focus")},focusout:function(e){t(e.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}})})(jQuery);(function(t){var e=!1;t(document).mouseup(function(){e=!1}),t.widget("ui.mouse",{version:"1.10.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.bind("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).bind("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):undefined}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&t(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(i){if(!e){this._mouseStarted&&this._mouseUp(i),this._mouseDownEvent=i;var s=this,n=1===i.which,a="string"==typeof this.options.cancel&&i.target.nodeName?t(i.target).closest(this.options.cancel).length:!1;return n&&!a&&this._mouseCapture(i)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){s.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(i)&&this._mouseDelayMet(i)&&(this._mouseStarted=this._mouseStart(i)!==!1,!this._mouseStarted)?(i.preventDefault(),!0):(!0===t.data(i.target,this.widgetName+".preventClickEvent")&&t.removeData(i.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return s._mouseMove(t)},this._mouseUpDelegate=function(t){return s._mouseUp(t)},t(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),i.preventDefault(),e=!0,!0)):!0}},_mouseMove:function(e){return t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button?this._mouseUp(e):this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){return t(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),!1},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})})(jQuery);(function(t){var e=5;t.widget("ui.slider",t.ui.mouse,{version:"1.10.4",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,i,s=this.options,n=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),a="",o=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),e=n.length;i>e;e++)o.push(a);this.handles=n.add(t(o.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(e){t(this).data("ui-slider-handle-index",e)})},_createRange:function(){var e=this.options,i="";e.range?(e.range===!0&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:t.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=t("").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===e.range||"max"===e.range?" ui-slider-range-"+e.range:""))):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){var t=this.handles.add(this.range).filter("a");this._off(t),this._on(t,this._handleEvents),this._hoverable(t),this._focusable(t)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(e){var i,s,n,a,o,r,l,h,u=this,c=this.options;return c.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:e.pageX,y:e.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var i=Math.abs(s-u.values(e));(n>i||n===i&&(e===u._lastChangedValue||u.values(e)===c.min))&&(n=i,a=t(this),o=e)}),r=this._start(e,o),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=o,a.addClass("ui-state-active").focus(),l=a.offset(),h=!t(e.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=h?{left:0,top:0}:{left:e.pageX-l.left-a.width()/2,top:e.pageY-l.top-a.height()/2-(parseInt(a.css("borderTopWidth"),10)||0)-(parseInt(a.css("borderBottomWidth"),10)||0)+(parseInt(a.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(e,o,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,i),!1},_mouseStop:function(t){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,i,s,n,a;return"horizontal"===this.orientation?(e=this.elementSize.width,i=t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,i=t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/e,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),a=this._valueMin()+s*n,this._trimAlignValue(a)},_start:function(t,e){var i={handle:this.handles[e],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._trigger("start",t,i)},_slide:function(t,e,i){var s,n,a;this.options.values&&this.options.values.length?(s=this.values(e?0:1),2===this.options.values.length&&this.options.range===!0&&(0===e&&i>s||1===e&&s>i)&&(i=s),i!==this.values(e)&&(n=this.values(),n[e]=i,a=this._trigger("slide",t,{handle:this.handles[e],value:i,values:n}),s=this.values(e?0:1),a!==!1&&this.values(e,i))):i!==this.value()&&(a=this._trigger("slide",t,{handle:this.handles[e],value:i}),a!==!1&&this.value(i))},_stop:function(t,e){var i={handle:this.handles[e],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._trigger("stop",t,i)},_change:function(t,e){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[e],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._lastChangedValue=e,this._trigger("change",t,i)}},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),this._change(null,0),undefined):this._value()},values:function(e,i){var s,n,a;if(arguments.length>1)return this.options.values[e]=this._trimAlignValue(i),this._refreshValue(),this._change(null,e),undefined;if(!arguments.length)return this._values();if(!t.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(e):this.value();for(s=this.options.values,n=arguments[0],a=0;s.length>a;a+=1)s[a]=this._trimAlignValue(n[a]),this._change(null,a);this._refreshValue()},_setOption:function(e,i){var s,n=0;switch("range"===e&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),t.isArray(this.options.values)&&(n=this.options.values.length),t.Widget.prototype._setOption.apply(this,arguments),e){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue();break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=0;n>s;s+=1)this._change(null,s);this._animateOff=!1;break;case"min":case"max":this._animateOff=!0,this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,i,s;if(arguments.length)return e=this.options.values[t],e=this._trimAlignValue(e);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(t){if(this._valueMin()>=t)return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=this.options.step>0?this.options.step:1,i=(t-this._valueMin())%e,s=t-i;return 2*Math.abs(i)>=e&&(s+=i>0?e:-e),parseFloat(s.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var e,i,s,n,a,o=this.options.range,r=this.options,l=this,h=this._animateOff?!1:r.animate,u={};this.options.values&&this.options.values.length?this.handles.each(function(s){i=100*((l.values(s)-l._valueMin())/(l._valueMax()-l._valueMin())),u["horizontal"===l.orientation?"left":"bottom"]=i+"%",t(this).stop(1,1)[h?"animate":"css"](u,r.animate),l.options.range===!0&&("horizontal"===l.orientation?(0===s&&l.range.stop(1,1)[h?"animate":"css"]({left:i+"%"},r.animate),1===s&&l.range[h?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:r.animate})):(0===s&&l.range.stop(1,1)[h?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&l.range[h?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:r.animate}))),e=i}):(s=this.value(),n=this._valueMin(),a=this._valueMax(),i=a!==n?100*((s-n)/(a-n)):0,u["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[h?"animate":"css"](u,r.animate),"min"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({width:i+"%"},r.animate),"max"===o&&"horizontal"===this.orientation&&this.range[h?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:r.animate}),"min"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({height:i+"%"},r.animate),"max"===o&&"vertical"===this.orientation&&this.range[h?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:r.animate}))},_handleEvents:{keydown:function(i){var s,n,a,o,r=t(i.target).data("ui-slider-handle-index");switch(i.keyCode){case t.ui.keyCode.HOME:case t.ui.keyCode.END:case t.ui.keyCode.PAGE_UP:case t.ui.keyCode.PAGE_DOWN:case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(i.preventDefault(),!this._keySliding&&(this._keySliding=!0,t(i.target).addClass("ui-state-active"),s=this._start(i,r),s===!1))return}switch(o=this.options.step,n=a=this.options.values&&this.options.values.length?this.values(r):this.value(),i.keyCode){case t.ui.keyCode.HOME:a=this._valueMin();break;case t.ui.keyCode.END:a=this._valueMax();break;case t.ui.keyCode.PAGE_UP:a=this._trimAlignValue(n+(this._valueMax()-this._valueMin())/e);break;case t.ui.keyCode.PAGE_DOWN:a=this._trimAlignValue(n-(this._valueMax()-this._valueMin())/e);break;case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:if(n===this._valueMax())return;a=this._trimAlignValue(n+o);break;case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(n===this._valueMin())return;a=this._trimAlignValue(n-o)}this._slide(i,r,a)},click:function(t){t.preventDefault()},keyup:function(e){var i=t(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,i),this._change(e,i),t(e.target).removeClass("ui-state-active"))}}})})(jQuery); /* * jQuery mmenu header addon * @requires mmenu 4.0.0 or later * * mmenu.frebsite.nl * * Copyright (c) Fred Heusschen * www.frebsite.nl * * Dual licensed under the MIT and GPL licenses. * http://en.wikipedia.org/wiki/MIT_License * http://en.wikipedia.org/wiki/GNU_General_Public_License */ !function(e){var t="mmenu",a="header";e[t].prototype["_addon_"+a]=function(){var n=this,r=this.opts[a],d=this.conf[a],s=e[t]._c,i=(e[t]._d,e[t]._e);s.add("header hasheader prev next title titletext"),i.add("updateheader");var o=e[t].glbl;if("boolean"==typeof r&&(r={add:r,update:r}),"object"!=typeof r&&(r={}),r=e.extend(!0,{},e[t].defaults[a],r),r.add){var h=r.content?r.content:'';e('').prependTo(this.$menu).append(h)}var p=e("div."+s.header,this.$menu);if(p.length&&this.$menu.addClass(s.hasheader),r.update&&p.length){var l=p.find("."+s.title),u=p.find("."+s.prev),f=p.find("."+s.next),c="#"+o.$page.attr("id");u.add(f).on(i.click,function(t){t.preventDefault(),t.stopPropagation();var a=e(this).attr("href");"#"!==a&&(a==c?n.$menu.trigger(i.close):e(a,n.$menu).trigger(i.open))}),e("."+s.panel,this.$menu).each(function(){var t=e(this),a=e("."+d.panelHeaderClass,t).text(),n=e("."+d.panelPrevClass,t).attr("href"),o=e("."+d.panelNextClass,t).attr("href");a||(a=e("."+s.subclose,t).text()),a||(a=r.title),n||(n=e("."+s.subclose,t).attr("href")),t.off(i.updateheader).on(i.updateheader,function(e){e.stopPropagation(),l[a?"show":"hide"]().text(a),u[n?"show":"hide"]().attr("href",n),f[o?"show":"hide"]().attr("href",o)}),t.on(i.open,function(){e(this).trigger(i.updateheader)})}).filter("."+s.current).trigger(i.updateheader)}},e[t].defaults[a]={add:!1,content:!1,update:!1,title:"Menu"},e[t].configuration[a]={panelHeaderClass:"Header",panelNextClass:"Next",panelPrevClass:"Prev"},e[t].addons=e[t].addons||[],e[t].addons.push(a)}(jQuery); /*! * jScroll - jQuery Plugin for Infinite Scrolling / Auto-Paging * @see @link{https://jscroll.com} * * @copyright Philip Klauzinski * @license Dual licensed under the MIT and GPL Version 2 licenses * @author Philip Klauzinski (https://webtopian.com) * @version 2.4.1 * @requires jQuery v1.8.0+ * @preserve */ !function(m){"use strict";m.jscroll={defaults:{debug:!1,autoTrigger:!0,autoTriggerUntil:!1,loadingHtml:"Loading...",loadingFunction:!1,padding:0,nextSelector:"a:last",contentSelector:"",pagingSelector:"",callback:!1}};var l=function(a,t){var n,e=a.data("jscroll"),l="function"==typeof t?{callback:t}:t,s=m.extend({},m.jscroll.defaults,l,e||{}),d="visible"===a.css("overflow-y"),o=a.find(s.nextSelector).first(),r=m(window),i=m("body"),f=d?r:a,c=m.trim(o.prop("href")+" "+s.contentSelector),g=function(){a.find(".jscroll-inner").length||a.contents().wrapAll('')},u=function(t){s.pagingSelector?t.closest(s.pagingSelector).hide():t.parent().not(".jscroll-inner,.jscroll-added").addClass("jscroll-next-parent").hide().length||t.wrap('').parent().hide()},p=function(){return f.unbind(".jscroll").removeData("jscroll").find(".jscroll-inner").children().unwrap().filter(".jscroll-added").children().unwrap()},j=function(){if(a.is(":visible")){g();var t=a.find("div.jscroll-inner").first(),n=a.data("jscroll"),e=parseInt(a.css("borderTopWidth"),10),l=isNaN(e)?0:e,o=parseInt(a.css("paddingTop"),10)+l,r=d?f.scrollTop():a.offset().top,i=t.length?t.offset().top:0,c=Math.ceil(r-i+f.height()+o);if(!n.waiting&&c+s.padding>=t.outerHeight())return b("info","jScroll:",t.outerHeight()-c,"from bottom. Loading next request..."),v()}},h=function(){var t=a.find(s.nextSelector).first();if(t.length)if(s.autoTrigger&&(!1===s.autoTriggerUntil||0').children(".jscroll-added").last().html(' '+s.loadingHtml+"").promise().done(function(){s.loadingFunction&&s.loadingFunction()}),a.animate({scrollTop:t.outerHeight()},0,function(){var o=r.nextHref;t.find("div.jscroll-added").last().load(o,function(t,n){if("error"===n)return p();var e,l=m(this).find(s.nextSelector).first();r.waiting=!1,r.nextHref=!!l.prop("href")&&m.trim(l.prop("href")+" "+s.contentSelector),m(".jscroll-next-parent",a).remove(),(e=e||a.data("jscroll"))&&e.nextHref?h():(b("warn","jScroll: nextSelector not found - destroying"),p()),s.callback&&s.callback.call(this,o),b("dir",r)})})},b=function(t){if(s.debug&&"object"==typeof console&&("object"==typeof t||"function"==typeof console[t]))if("object"==typeof t){var n=[];for(var e in t)"function"==typeof console[e]?(n=t[e].length?t[e]:[t[e]],console[e].apply(console,n)):console.log.apply(console,n)}else console[t].apply(console,Array.prototype.slice.call(arguments,1))};return a.data("jscroll",m.extend({},e,{initialized:!0,waiting:!1,nextHref:c})),g(),(n=m(s.loadingHtml).filter("img").attr("src"))&&((new Image).src=n),h(),m.extend(a.jscroll,{destroy:p}),a};m.fn.jscroll=function(e){return this.each(function(){var t=m(this),n=t.data("jscroll");n&&n.initialized||l(t,e)})}}(jQuery); /* cycle.js 2021-05-31 Public Domain. NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. This code should be minified before deployment. See https://www.crockford.com/jsmin.html USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO NOT CONTROL. */ // The file uses the WeakMap feature of ES6. /*jslint eval */ /*property $ref, decycle, forEach, get, indexOf, isArray, keys, length, push, retrocycle, set, stringify, test */ function decycle(object, replacer) { "use strict"; // Make a deep copy of an object or array, assuring that there is at most // one instance of each object or array in the resulting structure. The // duplicate references (which might be forming cycles) are replaced with // an object of the form // {"$ref": PATH} // where the PATH is a JSONPath string that locates the first occurance. // So, // var a = []; // a[0] = a; // return JSON.stringify(JSON.decycle(a)); // produces the string '[{"$ref":"$"}]'. // If a replacer function is provided, then it will be called for each value. // A replacer function receives a value and returns a replacement value. // JSONPath is used to locate the unique object. $ indicates the top level of // the object or array. [NUMBER] or [STRING] indicates a child element or // property. var objects = new WeakMap(); // object to path mappings return (function derez(value, path) { // The derez function recurses through the object, producing the deep copy. var old_path; // The path of an earlier occurance of value var nu; // The new object or array // If a replacer function was provided, then call it to get a replacement value. if (replacer !== undefined) { value = replacer(value); } // typeof null === "object", so go on if this value is really an object but not // one of the weird builtin objects. if ( typeof value === "object" && value !== null && !(value instanceof Boolean) && !(value instanceof Date) && !(value instanceof Number) && !(value instanceof RegExp) && !(value instanceof String) ) { // If the value is an object or array, look to see if we have already // encountered it. If so, return a {"$ref":PATH} object. This uses an // ES6 WeakMap. old_path = objects.get(value); if (old_path !== undefined) { return {$ref: old_path}; } // Otherwise, accumulate the unique value and its path. objects.set(value, path); // If it is an array, replicate the array. if (Array.isArray(value)) { nu = []; value.forEach(function (element, i) { nu[i] = derez(element, path + "[" + i + "]"); }); } else { // If it is an object, replicate the object. nu = {}; Object.keys(value).forEach(function (name) { nu[name] = derez( value[name], path + "[" + JSON.stringify(name) + "]" ); }); } return nu; } return value; }(object, "$")); } /* if (typeof JSON.decycle !== "function") { JSON.decycle = function decycle(object, replacer) { "use strict"; // Make a deep copy of an object or array, assuring that there is at most // one instance of each object or array in the resulting structure. The // duplicate references (which might be forming cycles) are replaced with // an object of the form // {"$ref": PATH} // where the PATH is a JSONPath string that locates the first occurance. // So, // var a = []; // a[0] = a; // return JSON.stringify(JSON.decycle(a)); // produces the string '[{"$ref":"$"}]'. // If a replacer function is provided, then it will be called for each value. // A replacer function receives a value and returns a replacement value. // JSONPath is used to locate the unique object. $ indicates the top level of // the object or array. [NUMBER] or [STRING] indicates a child element or // property. var objects = new WeakMap(); // object to path mappings return (function derez(value, path) { // The derez function recurses through the object, producing the deep copy. var old_path; // The path of an earlier occurance of value var nu; // The new object or array // If a replacer function was provided, then call it to get a replacement value. if (replacer !== undefined) { value = replacer(value); } // typeof null === "object", so go on if this value is really an object but not // one of the weird builtin objects. if ( typeof value === "object" && value !== null && !(value instanceof Boolean) && !(value instanceof Date) && !(value instanceof Number) && !(value instanceof RegExp) && !(value instanceof String) ) { // If the value is an object or array, look to see if we have already // encountered it. If so, return a {"$ref":PATH} object. This uses an // ES6 WeakMap. old_path = objects.get(value); if (old_path !== undefined) { return {$ref: old_path}; } // Otherwise, accumulate the unique value and its path. objects.set(value, path); // If it is an array, replicate the array. if (Array.isArray(value)) { nu = []; value.forEach(function (element, i) { nu[i] = derez(element, path + "[" + i + "]"); }); } else { // If it is an object, replicate the object. nu = {}; Object.keys(value).forEach(function (name) { nu[name] = derez( value[name], path + "[" + JSON.stringify(name) + "]" ); }); } return nu; } return value; }(object, "$")); }; }*/ if (typeof JSON.retrocycle !== "function") { JSON.retrocycle = function retrocycle($) { "use strict"; // Restore an object that was reduced by decycle. Members whose values are // objects of the form // {$ref: PATH} // are replaced with references to the value found by the PATH. This will // restore cycles. The object will be mutated. // The eval function is used to locate the values described by a PATH. The // root object is kept in a $ variable. A regular expression is used to // assure that the PATH is extremely well formed. The regexp contains nested // * quantifiers. That has been known to have extremely bad performance // problems on some browsers for very long strings. A PATH is expected to be // reasonably short. A PATH is allowed to belong to a very restricted subset of // Goessner's JSONPath. // So, // var s = '[{"$ref":"$"}]'; // return JSON.retrocycle(JSON.parse(s)); // produces an array containing a single element which is the array itself. var px = /^\$(?:\[(?:\d+|"(?:[^\\"\u0000-\u001f]|\\(?:[\\"\/bfnrt]|u[0-9a-zA-Z]{4}))*")\])*$/; (function rez(value) { // The rez function walks recursively through the object looking for $ref // properties. When it finds one that has a value that is a path, then it // replaces the $ref object with a reference to the value that is found by // the path. if (value && typeof value === "object") { if (Array.isArray(value)) { value.forEach(function (element, i) { if (typeof element === "object" && element !== null) { var path = element.$ref; if (typeof path === "string" && px.test(path)) { value[i] = eval(path); } else { rez(element); } } }); } else { Object.keys(value).forEach(function (name) { var item = value[name]; if (typeof item === "object" && item !== null) { var path = item.$ref; if (typeof path === "string" && px.test(path)) { value[name] = eval(path); } else { rez(item); } } }); } } }($)); return $; }; } (function(){var $,Range,Trie,indexOf=[].indexOf||function(item){for(var i=0,l=this.length;i=ref1;n=ref<=ref1?++k:--k){trie.push(n)}}else if(range.match(/^\d+$/)){trie.push(range)}else{throw Error("Invalid range '"+r+"'")}}return new Range(trie)};Range.prototype.match=function(number){return this.trie.find(number)};return Range}();$=jQuery;$.fn.validateCreditCard=function(callback,options){var bind,card,card_type,card_types,get_card_type,is_valid_length,is_valid_luhn,j,len,normalize,ref,validate,validate_number;card_types=[{name:"amex",range:"34,37",valid_length:[15]},{name:"diners_club_carte_blanche",range:"300-305",valid_length:[14]},{name:"diners_club_international",range:"36",valid_length:[14]},{name:"jcb",range:"3528-3589",valid_length:[16]},{name:"laser",range:"6304, 6706, 6709, 6771",valid_length:[16,17,18,19]},{name:"visa_electron",range:"4026, 417500, 4508, 4844, 4913, 4917",valid_length:[16]},{name:"visa",range:"4",valid_length:[13,14,15,16,17,18,19]},{name:"mastercard",range:"51-55,2221-2720",valid_length:[16]},{name:"discover",range:"6011, 622126-622925, 644-649, 65",valid_length:[16]},{name:"dankort",range:"5019",valid_length:[16]},{name:"maestro",range:"50, 56-69",valid_length:[12,13,14,15,16,17,18,19]},{name:"uatp",range:"1",valid_length:[15]}];bind=false;if(callback){if(typeof callback==="object"){options=callback;bind=false;callback=null}else if(typeof callback==="function"){bind=true}}if(options==null){options={}}if(options.accept==null){options.accept=function(){var j,len,results;results=[];for(j=0,len=card_types.length;j =0){results.push(card)}}return results}();for(k=0,len1=ref1.length;k =0};validate_number=function(number){var length_valid,luhn_valid;card_type=get_card_type(number);luhn_valid=false;length_valid=false;if(card_type!=null){luhn_valid=is_valid_luhn(number);length_valid=is_valid_length(number,card_type)}return{card_type:card_type,valid:luhn_valid&&length_valid,luhn_valid:luhn_valid,length_valid:length_valid}};validate=function(_this){return function(){var number;number=normalize($(_this).val());return validate_number(number)}}(this);normalize=function(number){return number.replace(/[ -]/g,"")};if(!bind){return validate()}this.on("input.jccv",function(_this){return function(){$(_this).off("keyup.jccv");return callback.call(_this,validate())}}(this));this.on("keyup.jccv",function(_this){return function(){return callback.call(_this,validate())}}(this));callback.call(this,validate());return this}}).call(this); /* * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ * * Uses the built in easing capabilities added In jQuery 1.1 * to offer multiple easing options * * TERMS OF USE - jQuery Easing * * Open source under the BSD License. * * Copyright 2008 George McGinley Smith * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the author nor the names of contributors may be used to endorse * or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * */ jQuery.easing["jswing"]=jQuery.easing["swing"];jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(a,b,c,d,e){return jQuery.easing[jQuery.easing.def](a,b,c,d,e)},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c},easeInOutQuad:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b+c;return-d/2*(--b*(b-2)-1)+c},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c},easeInOutCubic:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b+c;return d/2*((b-=2)*b*b+2)+c},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c},easeOutQuart:function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c},easeInOutQuart:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b+c;return-d/2*((b-=2)*b*b*b-2)+c},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c},easeInOutQuint:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b*b+c;return d/2*((b-=2)*b*b*b*b+2)+c},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c},easeInOutSine:function(a,b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c},easeInExpo:function(a,b,c,d,e){return b==0?c:d*Math.pow(2,10*(b/e-1))+c},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c},easeInOutExpo:function(a,b,c,d,e){if(b==0)return c;if(b==e)return c+d;if((b/=e/2)<1)return d/2*Math.pow(2,10*(b-1))+c;return d/2*(-Math.pow(2,-10*--b)+2)+c},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c},easeInOutCirc:function(a,b,c,d,e){if((b/=e/2)<1)return-d/2*(Math.sqrt(1-b*b)-1)+c;return d/2*(Math.sqrt(1-(b-=2)*b)+1)+c},easeInElastic:function(a,b,c,d,e){var f=1.70158;var g=0;var h=d;if(b==0)return c;if((b/=e)==1)return c+d;if(!g)g=e*.3;if(h * MIT Licensed. * * http://ricostacruz.com/jquery.transit * http://github.com/rstacruz/jquery.transit */ ;(function(k){k.transit={version:"0.9.9",propertyMap:{marginLeft:"margin",marginRight:"margin",marginBottom:"margin",marginTop:"margin",paddingLeft:"padding",paddingRight:"padding",paddingBottom:"padding",paddingTop:"padding"},enabled:true,useTransitionEnd:false};var d=document.createElement("div");var q={};function b(v){if(v in d.style){return v}var u=["Moz","Webkit","O","ms"];var r=v.charAt(0).toUpperCase()+v.substr(1);if(v in d.style){return v}for(var t=0;t -1;q.transition=b("transition");q.transitionDelay=b("transitionDelay");q.transform=b("transform");q.transformOrigin=b("transformOrigin");q.transform3d=e();var i={transition:"transitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",WebkitTransition:"webkitTransitionEnd",msTransition:"MSTransitionEnd"};var f=q.transitionEnd=i[q.transition]||null;for(var p in q){if(q.hasOwnProperty(p)&&typeof k.support[p]==="undefined"){k.support[p]=q[p]}}d=null;k.cssEase={_default:"ease","in":"ease-in",out:"ease-out","in-out":"ease-in-out",snap:"cubic-bezier(0,1,.5,1)",easeOutCubic:"cubic-bezier(.215,.61,.355,1)",easeInOutCubic:"cubic-bezier(.645,.045,.355,1)",easeInCirc:"cubic-bezier(.6,.04,.98,.335)",easeOutCirc:"cubic-bezier(.075,.82,.165,1)",easeInOutCirc:"cubic-bezier(.785,.135,.15,.86)",easeInExpo:"cubic-bezier(.95,.05,.795,.035)",easeOutExpo:"cubic-bezier(.19,1,.22,1)",easeInOutExpo:"cubic-bezier(1,0,0,1)",easeInQuad:"cubic-bezier(.55,.085,.68,.53)",easeOutQuad:"cubic-bezier(.25,.46,.45,.94)",easeInOutQuad:"cubic-bezier(.455,.03,.515,.955)",easeInQuart:"cubic-bezier(.895,.03,.685,.22)",easeOutQuart:"cubic-bezier(.165,.84,.44,1)",easeInOutQuart:"cubic-bezier(.77,0,.175,1)",easeInQuint:"cubic-bezier(.755,.05,.855,.06)",easeOutQuint:"cubic-bezier(.23,1,.32,1)",easeInOutQuint:"cubic-bezier(.86,0,.07,1)",easeInSine:"cubic-bezier(.47,0,.745,.715)",easeOutSine:"cubic-bezier(.39,.575,.565,1)",easeInOutSine:"cubic-bezier(.445,.05,.55,.95)",easeInBack:"cubic-bezier(.6,-.28,.735,.045)",easeOutBack:"cubic-bezier(.175, .885,.32,1.275)",easeInOutBack:"cubic-bezier(.68,-.55,.265,1.55)"};k.cssHooks["transit:transform"]={get:function(r){return k(r).data("transform")||new j()},set:function(s,r){var t=r;if(!(t instanceof j)){t=new j(t)}if(q.transform==="WebkitTransform"&&!a){s.style[q.transform]=t.toString(true)}else{s.style[q.transform]=t.toString()}k(s).data("transform",t)}};k.cssHooks.transform={set:k.cssHooks["transit:transform"].set};if(k.fn.jquery<"1.8"){k.cssHooks.transformOrigin={get:function(r){return r.style[q.transformOrigin]},set:function(r,s){r.style[q.transformOrigin]=s}};k.cssHooks.transition={get:function(r){return r.style[q.transition]},set:function(r,s){r.style[q.transition]=s}}}n("scale");n("translate");n("rotate");n("rotateX");n("rotateY");n("rotate3d");n("perspective");n("skewX");n("skewY");n("x",true);n("y",true);function j(r){if(typeof r==="string"){this.parse(r)}return this}j.prototype={setFromString:function(t,s){var r=(typeof s==="string")?s.split(","):(s.constructor===Array)?s:[s];r.unshift(t);j.prototype.set.apply(this,r)},set:function(s){var r=Array.prototype.slice.apply(arguments,[1]);if(this.setter[s]){this.setter[s].apply(this,r)}else{this[s]=r.join(",")}},get:function(r){if(this.getter[r]){return this.getter[r].apply(this)}else{return this[r]||0}},setter:{rotate:function(r){this.rotate=o(r,"deg")},rotateX:function(r){this.rotateX=o(r,"deg")},rotateY:function(r){this.rotateY=o(r,"deg")},scale:function(r,s){if(s===undefined){s=r}this.scale=r+","+s},skewX:function(r){this.skewX=o(r,"deg")},skewY:function(r){this.skewY=o(r,"deg")},perspective:function(r){this.perspective=o(r,"px")},x:function(r){this.set("translate",r,null)},y:function(r){this.set("translate",null,r)},translate:function(r,s){if(this._translateX===undefined){this._translateX=0}if(this._translateY===undefined){this._translateY=0}if(r!==null&&r!==undefined){this._translateX=o(r,"px")}if(s!==null&&s!==undefined){this._translateY=o(s,"px")}this.translate=this._translateX+","+this._translateY}},getter:{x:function(){return this._translateX||0},y:function(){return this._translateY||0},scale:function(){var r=(this.scale||"1,1").split(",");if(r[0]){r[0]=parseFloat(r[0])}if(r[1]){r[1]=parseFloat(r[1])}return(r[0]===r[1])?r[0]:r},rotate3d:function(){var t=(this.rotate3d||"0,0,0,0deg").split(",");for(var r=0;r<=3;++r){if(t[r]){t[r]=parseFloat(t[r])}}if(t[3]){t[3]=o(t[3],"deg")}return t}},parse:function(s){var r=this;s.replace(/([a-zA-Z0-9]+)\((.*?)\)/g,function(t,v,u){r.setFromString(v,u)})},toString:function(t){var s=[];for(var r in this){if(this.hasOwnProperty(r)){if((!q.transform3d)&&((r==="rotateX")||(r==="rotateY")||(r==="perspective")||(r==="transformOrigin"))){continue}if(r[0]!=="_"){if(t&&(r==="scale")){s.push(r+"3d("+this[r]+",1)")}else{if(t&&(r==="translate")){s.push(r+"3d("+this[r]+",0)")}else{s.push(r+"("+this[r]+")")}}}}}return s.join(" ")}};function m(s,r,t){if(r===true){s.queue(t)}else{if(r){s.queue(r,t)}else{t()}}}function h(s){var r=[];k.each(s,function(t){t=k.camelCase(t);t=k.transit.propertyMap[t]||k.cssProps[t]||t;t=c(t);if(k.inArray(t,r)===-1){r.push(t)}});return r}function g(s,v,x,r){var t=h(s);if(k.cssEase[x]){x=k.cssEase[x]}var w=""+l(v)+" "+x;if(parseInt(r,10)>0){w+=" "+l(r)}var u=[];k.each(t,function(z,y){u.push(y+" "+w)});return u.join(", ")}k.fn.transition=k.fn.transit=function(z,s,y,C){var D=this;var u=0;var w=true;if(typeof s==="function"){C=s;s=undefined}if(typeof y==="function"){C=y;y=undefined}if(typeof z.easing!=="undefined"){y=z.easing;delete z.easing}if(typeof z.duration!=="undefined"){s=z.duration;delete z.duration}if(typeof z.complete!=="undefined"){C=z.complete;delete z.complete}if(typeof z.queue!=="undefined"){w=z.queue;delete z.queue}if(typeof z.delay!=="undefined"){u=z.delay;delete z.delay}if(typeof s==="undefined"){s=k.fx.speeds._default}if(typeof y==="undefined"){y=k.cssEase._default}s=l(s);var E=g(z,s,y,u);var B=k.transit.enabled&&q.transition;var t=B?(parseInt(s,10)+parseInt(u,10)):0;if(t===0){var A=function(F){D.css(z);if(C){C.apply(D)}if(F){F()}};m(D,w,A);return D}var x={};var r=function(H){var G=false;var F=function(){if(G){D.unbind(f,F)}if(t>0){D.each(function(){this.style[q.transition]=(x[this]||null)})}if(typeof C==="function"){C.apply(D)}if(typeof H==="function"){H()}};if((t>0)&&(f)&&(k.transit.useTransitionEnd)){G=true;D.bind(f,F)}else{window.setTimeout(F,t)}D.each(function(){if(t>0){this.style[q.transition]=E}k(this).css(z)})};var v=function(F){this.offsetWidth;r(F)};m(D,w,v);return this};function n(s,r){if(!r){k.cssNumber[s]=true}k.transit.propertyMap[s]=q.transform;k.cssHooks[s]={get:function(v){var u=k(v).css("transit:transform");return u.get(s)},set:function(v,w){var u=k(v).css("transit:transform");u.setFromString(s,w);k(v).css({"transit:transform":u})}}}function c(r){return r.replace(/([A-Z])/g,function(s){return"-"+s.toLowerCase()})}function o(s,r){if((typeof s==="string")&&(!s.match(/^[\-0-9\.]+$/))){return s}else{return""+s+r}}function l(s){var r=s;if(k.fx.speeds[r]){r=k.fx.speeds[r]}return o(r,"ms")}k.transit.getTransitionValue=g})(jQuery); var hasEasing="easeOutQuad"in jQuery.easing||jQuery.fn.transition?!0:!1,hasCSSTransitions=$.support.transition?!0:!1,hasTouch=jQuery.fn.swipe?!0:!1 hasCSSTransitions&&jQuery.fn.transition||($.fn.transition=$.fn.animate),function(t,n,e,i){var o="ontouchstart"in n||navigator.msMaxTouchPoints>0 t.createPlugin=function(e,r){function s(){n.console&&console.log&&console.log("[createPlugin] "+Array.prototype.join.call(arguments," // "))}function a(t){return"object"!=typeof t||"Object"!==Object.prototype.toString.call(t).slice(8,-1)}if("string"!=typeof e||!e)return s("Error: you must specify a valid plugin name on the first parameter of the method.",e),i if(r==i||!r||a(r))return s("Error: you must specify a valid plugin implementation on the second parameter of the method.",r),i if("function"==typeof t.fn[e])return s("Error: there's already a jQuery plugin defined with this name.",e,t.fn[e].constructor),i "function"!=typeof Object.create&&(Object.create=function(t){function n(){}return n.prototype=t,new n}) var u={isTouch:o,hasTouch:hasTouch,hasCSSTransitions:hasCSSTransitions,hasEasing:hasEasing,debug:!1,log_indent:" - "},c={_name:"",_defaults:{},_init:function(n,e,i){this._name=n,this.element=e,this.$element=t(e),this.options=t.extend(u,this._defaults,i),this.viewHeight=this.$element.outerHeight(),this.viewWidth=this.$element.outerWidth(),"function"==typeof this.init&&this.init()},set:function(t,n){if(i!==this.options[t])this.options[t]=n else{if(i===this[t])return!1 this[t]=n}return!0},get:function(t){return this.options[t]},_log:function(t){n.console&&console.log?console.log("["+this._name+"] - "+Array.prototype.join.call(arguments," // ")):alert("["+this._name+"] - "+Array.prototype.join.call(arguments," // "))}} t.fn[e]=function(n){var o,s=Array.prototype.slice.call(arguments,1) return this.each(function(){var i=this,a=(t(i),"modmb_"+e),u=t.data(i,a) if(!u){var h=t.extend({},c,r) u=t.data(i,a,Object.create(h)),u&&"function"==typeof u._init&&u._init.apply(u,[e,i,n])}if(u&&"string"==typeof n&&"_"!==n[0]&&"init"!==n){var f="destroy"==n?"_destroy":n "function"==typeof u[f]&&(o=u[f].apply(u,s)),"destroy"===n&&t.data(i,a,null)}}),o!==i?o:this}}}(window.jQuery,window,document) var pkd_cart={_defaults:{callbacks:{}},init:function(){},refresh:function(){if(this.options.debug){var log="refresh()";this._log(log)}},update_values:function(){var instance=this;var action=this.$element.data("action")||"get_values";if($.trim(action)!=""){this.request([action,this.$element.data(),function(){if(this.data!=""){var plugin=this.instance;$.each(this.data.values,function(idx,val){if(idx=="total"){$("#opamt").text(val.value)}if($("."+idx).length>0){if(val.value>0){plugin.$element.addClass("active").find("."+idx).fadeOut("fast",function(){$(this).html(val.html).fadeIn("fast")})}else{plugin.$element.removeClass("active").find("."+idx).fadeOut("fast",function(){$(this).html(val.html).fadeIn("fast")})}}})}}])}},get_clean_data:function(raw_data){delete raw_data.modmb_pkdcart;if(typeof raw_data.form_data!=="undefined"&&raw_data.form_data.length>0){var keys=[];$.each(raw_data.form_data,function(key,value){if(typeof value.value=="object"){raw_data.form_data[key].value="[object]"}})}var clean_data=JSON.stringify(decycle(raw_data));clean_data=clean_data.replace(/^(\"|\')+/,"");clean_data=clean_data.replace(/(\"|\')+$/,"");clean_data=clean_data.replace(/\|/,"");clean_data=clean_data.replace(/&/g,"%26");return clean_data},request:function(params){var instance=this;var action=typeof params[0]==="undefined"?"":params[0];var data=this.get_clean_data(typeof params[1]==="undefined"?"":params[1]);var callback=typeof params[2]==="undefined"?$.noop():params[2];var callback_item_error=typeof params[3]==="undefined"?$.noop():params[3];var response_data="";$.ajax({type:"POST",url:"/manager/include/ajax_cart.php",data:"a_func="+action+"&a_params="+data,success:function(response){if($.trim(response)!=""){response_data=jQuery.parseJSON(response)}},error:function(jqXHR,textStatus,error){if(window.console&&console.log)console.log("[cart_request] ["+action+"] ["+textStatus+"] "+(error!=""?"["+error+"] ":"")+general_ajax_error)},complete:function(){if(action!="get_values"&&response_data["has_item_error"]){if($.isFunction(callback_item_error)){callback_item_error.call({data:response_data,instance:instance})}}else{if($.isFunction(callback)){callback.call({data:response_data,instance:instance})}}}})},_destroy:function(){}};$.createPlugin("pkdcart",pkd_cart); var modmb_wizard={fromSkip:false,_defaults:{completed:[],active:1,skipCompleted:true,resetFeedback:true,onBeforeNext:"",onNext:"",onChange:"",onBeforeFinish:"",onFinish:"",onAfterFinish:"",onSkip:""},init:function(){var instance=this;this.wizard_panels_length=0;this.$wizard_panels=[];$.each(this.$element.data(),function(idx,value){$.each(instance._defaults,function(key,obj){if(key==idx){if($.isArray(obj)){value=value+"";instance.options[key]=value.split(",");if(key=="completed"){$.each(instance.options[key],function(key2,value2){instance.options[key][key2]=parseInt(value2)})}}else{instance.options[key]=value}return false}})});this.$element.children(".panel").each(function(idx){var $ele=$(this);var index=idx+1;instance.wizard_panels_length++;instance.$wizard_panels[index]=$ele;$ele.addClass("wizard-todo");if(index==instance.options.active){instance.last_active=index;instance.active=index;instance.next_active=index+1;$ele.addClass("wizard-active").children(".panel-collapse").addClass("in")}if($.inArray(index,instance.options.completed)>-1){$ele.addClass("wizard-complete wizard-completed").removeClass("wizard-todo").children(".panel-collapse").addClass("in")}$ele.data("wizard_index",index);$ele.data("wizard_next",$ele.find(".wizard-next"));$ele.data("wizard_change",$ele.find(".wizard-change"));$ele.data("wizard_skip",$ele.find(".wizard-skip"));$ele.data("wizard_finish",$ele.find(".wizard-finish"));$ele.data("wizard_panel",$ele.find(".panel-collapse"));$ele.data("wizard_next_panel",$($ele.data("wizard_next").attr("href")));$ele.data("wizard_next_panel_parent",$ele.data("wizard_next_panel").parent());$ele.data("wizard_change_panel",$($ele.data("wizard_change").attr("href")));$ele.data("wizard_change_panel_parent",$ele.data("wizard_change_panel").parent());if(instance.options.resetFeedback){$ele.data("wizard_feedback",$ele.find(".panel-feedback"))}instance._init_events($ele)})},refresh:function(){this.last_active=this.active;this.active=this.$wizard_panels[this.next_active].data("wizard_index");this.next_active=this.active+1;this.submit_btn.button("reset")},change:function($ele,callback){$active=this.$wizard_panels[this.active];var instance=this;var skip_scroll=true;if($active.hasClass("wizard-completed")&&$active.hasClass("wizard-todo")){$panel_completed=$active.find(".panel-update");$active.addClass("wizard-loading");var tpl_complete_data={tpl:$panel_completed.data("tpl-completed")};$panel_completed.ajax_template(tpl_complete_data,function(){$active.removeClass("wizard-loading").addClass("wizard-complete");$active.removeClass("wizard-active wizard-todo").children(".panel-collapse");instance.scroll_to_active()})}else{skip_scroll=false;$active.removeClass("wizard-active wizard-todo").children(".panel-collapse").removeClass("in").addClass("collapse")}if($active.children(".panel-collapse").hasClass("keep-in")){$active.children(".panel-collapse").removeClass("keep-in").addClass("in")}$ele.data("wizard_change_panel_parent").removeClass("wizard-complete").addClass("wizard-active wizard-todo");instance.next_active=$ele.data("wizard_change_panel_parent").data("wizard_index");instance.refresh();if(!skip_scroll){instance.scroll_to_active()}if(typeof callback!=="undefined"){callback()}if(instance.options.onChange!=""&&$.isFunction(instance.options.onChange)){instance.options.onChange.call({element:$active,change_ele:$ele,instance:instance})}},next:function(t,panel){panel=panel||this.$wizard_panels[this.active];this.submit_btn=t;this.submit_btn.button("loading");var panel_skip=true;if(typeof this.$wizard_panels[this.active+1].find(".panel-collapse").data("skip")!=="undefined"){panel_skip=this.$wizard_panels[this.active+1].find(".panel-collapse").data("skip")=="true"?true:false}var skip=this.options.skipCompleted&&panel_skip?this._check_for_skip(panel):false;if(this.options.onNext!=""&&$.isFunction(this.options.onNext)){if(!skip){this.$wizard_panels[this.next_active].addClass("wizard-loading")}this.options.onNext.call({element:panel,instance:this,skippingPanels:skip})}else if(!skip){this.$wizard_panels[this.next_active].addClass("wizard-loading");this.$wizard_panels[this.active].removeClass("wizard-active wizard-todo wizard-disabled").addClass("wizard-complete wizard-completed");this.next_panel()}if(skip){this.$wizard_panels[this.active].removeClass("wizard-active wizard-todo wizard-disabled").addClass("wizard-complete wizard-completed");this.next_active=this.last_active;this.$wizard_panels[this.next_active].addClass("wizard-loading")}},next_panel:function(){if(this.$wizard_panels[this.next_active].children(".panel-collapse").hasClass("in")){this.$wizard_panels[this.next_active].children(".panel-collapse").removeClass("in").addClass("keep-in")}this.$wizard_panels[this.next_active].children(".panel-collapse").collapse("show")},reset_feedback:function(){$.each(this.$wizard_panels,function(key,val){if(typeof val!=="undefined"){val.data("wizard_feedback").html("")}})},_init_events:function($ele){var instance=this;$ele.data("wizard_skip").on("click",function(event){event.preventDefault();instance.fromSkip=true;instance.submit_btn=$(this);instance.submit_btn.button("loading");instance.$wizard_panels[instance.active].removeClass("wizard-active wizard-todo wizard-disabled").addClass("wizard-complete wizard-completed");if(instance.options.onSkip!=""&&$.isFunction(instance.options.onSkip)){instance.options.onSkip.call({element:instance.$wizard_panels[instance.active],instance:instance})}instance.next_panel();return false});$ele.data("wizard_finish").on("click",function(event){event.preventDefault();instance.submit_btn=$(this);instance.submit_btn.button("loading");if(instance.options.onBeforeFinish!=""&&$.isFunction(instance.options.onBeforeFinish)){instance.options.onBeforeFinish.call({element:instance.$wizard_panels[instance.active],instance:instance,callback_finish:instance.options.onFinish!=""&&$.isFunction(instance.options.onFinish)?instance.options.onFinish:"",callback_after_finish:instance.options.onAfterFinish!=""&&$.isFunction(instance.options.onAfterFinish)?instance.options.onAfterFinish:""})}});$ele.data("wizard_change").on("click",function(event,callback){event.preventDefault();instance.submit_btn=$(this);if(instance.options.resetFeedback){instance.reset_feedback()}instance.submit_btn.button("loading");$panel_change=$ele.find(".panel-update");if($panel_change.data("tpl-change")!=="undefined"){var tpl_data={tpl:$panel_change.data("tpl-change")};$panel_change.ajax_template(tpl_data,function(){instance.change($ele,callback)})}else{instance.change($ele,callback)}return false});$ele.data("wizard_next").on("click",function(event){event.preventDefault();var $ele=instance.$wizard_panels[instance.active];var panel_id=$ele.find(".panel-collapse").attr("id");if(typeof instance.options.onBeforeNext[panel_id]!=="undefined"&&instance.options.onBeforeNext[panel_id]!=""&&$.isFunction(instance.options.onBeforeNext[panel_id])){instance.submit_btn=$(this);instance.submit_btn.button("loading");instance.options.onBeforeNext[panel_id].call({button:$(this),element:$ele,instance:instance})}else{instance.next($(this),$ele)}return false});$ele.on("show.bs.collapse",function(){});$ele.on("shown.bs.collapse",function(){instance.$wizard_panels[instance.next_active].removeClass("wizard-loading wizard-complete").addClass("wizard-active");instance.refresh();instance.scroll_to_active();if(instance.options.onNextAfter!=""&&$.isFunction(instance.options.onNextAfter)&&!instance.fromSkip){instance.options.onNextAfter.call({element:instance.$wizard_panels[instance.active],instance:instance})}instance.fromSkip=false})},afterFinish:function(_data){if(this.options.onAfterFinish!=""&&$.isFunction(this.options.onAfterFinish)){this.options.onAfterFinish.call({data:_data,instance:this,element:this.$wizard_panels[this.active]})}},scroll_to_active:function(){$("html,body").animate({scrollTop:this.$wizard_panels[this.active].offset().top+"px"},420,"swing")},_check_for_skip:function($panel){return this.last_active>$panel.data("wizard_next_panel_parent").data("wizard_index")},_destroy:function(){}};$.createPlugin("modmbwizard",modmb_wizard); var state_required=true;var braintree_use_paypal=braintree_use_paypal||false;var cart,$edit_cart_btn;$(function(){cart=$("#utils-cart").pkdcart("update_values");var line_items=$(".cart-line-items").pkdcart();checkRadio($("#payment").data("payment_type"));checkUSFB();$("#payment").on("change",'input[name="usfb"]',checkUSFB);pkd_init_card_validator();$(document).on("keydown","#fld_cardNumber",function(){$(this).parent().addClass("active")});$(document).on("keyup","#fld_cardNumber",function(){if($(this).parent().hasClass("valid")){var $invalid_cc=$(".invalid-cc");if($invalid_cc.parent().children("p").length==2){$invalid_cc.parent().hide()}else{$invalid_cc.hide()}}});modals.edit_cart=$("#edit_cart_modal");modals.edit_cart.on("shown.bs.modal",function(e){if(checkPageForItemErrors()){modals.edit_cart.find(".close").prop("disabled",true).addClass("hide")}if($(".gift-wrap-message").length>0){$(".gift-wrap-message-textarea").countCharValidation(250,".remaining-characters")}});modals.edit_cart.on("hide.bs.modal",function(){$("#cart-summary").ajax_template($("#cart-summary").data(),function(){checkCartSummary();if($("#review-order").length>0){$("#review-order .cart-line-items").ajax_template($("#review-order .cart-line-items").data())}})});if($("#capture_user_modal").length>0){modals.capture_user=$("#capture_user_modal");modals.capture_user.modal("show");modals.capture_user.on("hidden.bs.modal",function(e){checkForItemErrors()})}else{checkForItemErrors()}$(document).on("click",".edit-cart",function(event){event.preventDefault();$edit_cart_btn=$(this);$edit_cart_btn.button("loading");modals.edit_cart.data("backdrop",true);modals.edit_cart.ajax_template({tpl:"tpl.cart.v2.modal.edit_cart"},edit_items_modal_callback)});modals.add_to_cart=$("#add_to_cart_modal");$(document).on("click",".add-to-cart-ajax",function(event){event.preventDefault();var $_this=$(this);var $icon=$_this.find(".fa");var icon_classes=$icon.attr("class");$icon.removeAttr("class").addClass("fa fa-spinner fa-spin");var data={tpl:"tpl.cart.v2.modal.add_to_cart",sku:$_this.data("sku")};modals.add_to_cart.ajax_template(data,function(){modals.add_to_cart.modal("show");cart.pkdcart("request",["add",$_this.data(),function(){$icon.removeClass().addClass(icon_classes);var $modal_response=modals.add_to_cart.find(".modal-response");if(this.data.success){this.instance.update_values();$modal_response.html("");if(typeof ga!=="undefined"){ga("send","event","Cart","checkout-add-to-cart")}else if(typeof _gaq!=="undefined"){_gaq.push(["_trackEvent","Cart","checkout-add-to-cart"])}if(typeof gtag==="function"){gtag("event","add_to_cart",{currency:this.data.currency,value:this.data.subtotal,items:this.data.items})}if(typeof gtag_report_conversion==="function"){gtag_report_conversion(this.data.order_id,this.data.subtotal)}if(typeof _hsq!=="undefined"){_hsq.push(["trackEvent",{id:"checkout-add-to-cart"}])}if(typeof window[$_this.data("callback")]==="function"){window[$_this.data("callback")].call({data:this.data,instance:this.instance})}}else{$modal_response.html(' '+this.data.msg+"")}}])})});$(document).on("click",".add-to-cart-ajax-no-modal",function(event){event.preventDefault();var $_this=$(this);var $icon=$_this.find(".fa");var icon_classes=$icon.attr("class");$icon.removeAttr("class").addClass("fa fa-spinner fa-spin");cart.pkdcart("request",["add",$_this.data(),function(){$icon.removeClass().addClass(icon_classes);var $modal_response=modals.add_to_cart.find(".modal-response");if(this.data.success){this.instance.update_values();$modal_response.html("");if(typeof ga!=="undefined"){ga("send","event","Cart","checkout-add-to-cart")}else if(typeof _gaq!=="undefined"){_gaq.push(["_trackEvent","Cart","checkout-add-to-cart"])}pkd_add_item_success(this.data);if(typeof gtag_report_conversion==="function"){gtag_report_conversion(this.data.order_id,this.data.subtotal)}if(typeof _hsq!=="undefined"){_hsq.push(["trackEvent",{id:"checkout-add-to-cart"}])}if(typeof window[$_this.data("callback")]==="function"){window[$_this.data("callback")].call({data:this.data,instance:this.instance})}}else{$modal_response.html(''+this.data.msg+"")}}])});$(document).on("click",".update-item",function(event){var $_this=$(this);var $parent=$_this.parentsUntil(".cart-contents-row");var $_row=$parent.parent().parent().parent();$(this).append('');line_items.pkdcart("request",["update_item",$(this).data(),function(){$_row.find(".fa-spinner").fadeOut();if(this.data.success){location.reload(true)}else{$_row.find(".cart-alert").before(''+general_cart_error+"");$_row.find(".cart-alert-delay-remove").delay(4e3).fadeOut(function(){$(this).remove()})}}])});$(document).on("click",".gift-card input",function(event){if($(this).parent().parent().hasClass("disabled"))return false;event.stopPropagation()});$(document).on("click",".gift-card",function(event){if($(this).hasClass("disabled"))return false;let addClass=!$(this).hasClass("active");$(".gift-card").removeClass("active");$("#token_value").val("");if(addClass){$("#token_value").val($(this).data("id"));$(this).addClass("active")}else{$(".gift-card input:checked").prop("checked",false);return false}});$(document).on("click",".trigger-payment-change",function(event){event.preventDefault();$("#payment-label .wizard-change").trigger("click")});$(document).on("click",".giftcard-remove",function(event){event.preventDefault();var $_this=$(this);var $_row=$_this.closest(".giftcard-line-item");var $icon=$_this.find(".fa");var original_icon_class=$icon.attr("class");$icon.attr("class","fa fa-spinner fa-spin");$_this.prop("disabled",true);line_items.pkdcart("request",["giftcard_remove",$(this).data(),function(){var instance=this.instance;setTimeout(function(){$_row.fadeOut(function(){$(this).remove();location.reload(true)})},4200);if(this.data.success){}else{}}])});$(document).on("click",".remove-item-alert",function(event){$parent_row=$("#item_"+$(this).data("order_item_id"));if($parent_row.length>0){$parent_row.find('[class*="remove-item"]:visible').not(this).trigger("click")}});$(document).on("click",".remove-item",function(event){if(confirm(delete_confirm_msg)){var $_this=$(this);var $parent=$_this.parentsUntil(".cart-contents-row");var $_row=$parent.eq($parent.length-1).parent();$(this).append('');line_items.pkdcart("request",["remove",$(this).data(),function(){if(this.data.success){pkd_remove_item_success(this.data);if(parseInt(this.data.numitems)<1){$_row.fadeOut();window.location="/cart.php"}else{this.instance.update_values();cart.pkdcart("update_values");$_row.fadeOut(function(){$_row.remove();if($_row.parent().find(".cart-alert").length==0){$(".cart-checkout").removeClass("disabled")}})}}else{$_row.find(".fa-spinner").fadeOut();$_row.find(".alert").fadeOut();$_row.prepend(''+general_cart_error+"");$_row.find(".alert").delay(4e3).fadeOut(function(){$(this).remove()})}}])}});$(document).on("click",".remove-item-edit",function(event){if(confirm(delete_confirm_msg)){var $_this=$(this);var $parent=$_this.parentsUntil(".cart-contents-row");var $_row=$parent.eq($parent.length-1).parent();$_this.append('');cart.pkdcart("request",["remove",$(this).data(),function(){if(this.data.success){pkd_remove_item_success(this.data);if(parseInt(this.data.numitems)<1){$_row.fadeOut();location.reload(true)}else{$(".cart-line-items").pkdcart("update_values");$_row.fadeOut(function(){$_row.remove();if($_row.parent().find(".cart-alert").length==0){$(".cart-checkout").removeClass("disabled")}})}}else{$_row.find(".fa-spinner").fadeOut();$_row.find(".alert").fadeOut();$_row.prepend(''+general_cart_error+"");$_row.find(".alert").delay(4e3).fadeOut(function(){$(this).remove()})}}])}});$(".cart-quantity").each(function(){$(this).data("quantity",$(this).val())});$(document).on("change",".cart-quantity",function(){var $this=$(this);var $parent=$this.parent();var order_item_id=$this.data("order_item_id");var old_quantity=$this.data("quantity");var quantity=$this.val();if(quantity==0){$parent.parent().find(".remove-item, .remove-item-edit").trigger("click")}else{$parent.append('');var $icon=$parent.find(".fa");var data={order_item_id:order_item_id,quantity:quantity};cart.pkdcart("request",["change_quantity",data,function(){if(parseInt(quantity)>parseInt(old_quantity)){pkd_add_item_success(this.data)}else{pkd_remove_item_success(this.data)}$this.data("quantity",quantity);$(".cart-line-items").pkdcart("update_values");var $needs_update_qty=$("#item_"+order_item_id).find(".needs-update-quantity");if($needs_update_qty.length>0){$needs_update_qty.parent().remove();$(".cart-checkout").removeClass("disabled")}$icon.removeClass("fa-spinner fa-spin").addClass("fa-check");setTimeout(function(){$icon.remove()},1e3)},function(){$.each(this.data.errors,function(outerkey,errors){$.each(errors,function(key,val){var $response=$(".cart-contents-row-"+key).find(".cart-content-disclaimer");$response.find(".cart-alert-danger").fadeOut();$response.prepend(''+val+"")})});$icon.remove();$(".cart-checkout").addClass("disabled")}])}});if($("#print_modal").length>0)modals.print=$("#print_modal");$(document).on("click",".print-link",function(event){event.preventDefault();modals.print.modal("show")});$(document).on("click",".cart-toggle",function(){var $_this=$(this);$("#cart-summary-items-inner").slideToggle(function(){if($(this).is(":visible")){$_this.addClass("active").html(""+cart_hide_label);$("#cart-summary").data("cart-toggle","open");$("#cart-summary-items-inner").attr("aria-expanded",true)}else{$_this.removeClass("active").html(""+cart_show_label);$("#cart-summary").data("cart-toggle","closed");$("#cart-summary-items-inner").attr("aria-expanded",false)}})});$(document).on("click","#apply-coupon",function(event){var _this=$(this);var parent=_this.parent().parent().parent();var coupon_val=$("#coupon_code").val();if(coupon_val!=""){_this.append('');var icon=_this.find("i");line_items.pkdcart("request",["apply_coupon",{coupon_code:coupon_val},function(data){icon.remove();parent.find(".alert").remove();parent.prepend(this.data.msg);parent.find(".alert").delay(4e3).fadeOut(function(){$(this).remove()});if(this.data.success){$("#review-order .cart-line-items").ajax_template($("#review-order .cart-line-items").data(),function(){line_items.pkdcart("update_values");update_payment_panel()})}}])}return false});if($(".fld-state").length>0){state_required=$(".fld-state").hasClass("required")}checkCountry($(".fld-country"),false);$(document).on("change",".fld-country",function(){checkCountry(this,true)});$wizard=$("#wizard").modmbwizard({onChange:function(){var $change_ele=$(this.change_ele).find(".panel-collapse");if($change_ele.attr("id")=="payment"){checkUSFB();checkRadio($change_ele.data("payment_type"));if($("#token_value").length>0){if(window.Square){init_square_payment_form()}if(typeof braintree!=="undefined"){init_braintree_payment_form()}}if($change_ele.data("payment_type")=="Bill to Institution"){$('input[name="PONumber"]').val($change_ele.data("po_num"))}}if($change_ele.attr("id")=="payment"||$change_ele.attr("id")=="shipping"){if($(".fld-state").length>0){state_required=$(".fld-state").hasClass("required")}checkCountry($(".fld-country"),false)}if(typeof cart_panel_update==="function"){cart_panel_update($change_ele.attr("id"),"change")}},onSkip:function(){this.element.find(".panel-update").ajax_template({tpl:"tpl.blank"},function(){})},onBeforeFinish:function(){var _this=this;var _instance=this.instance;var _element=this.element;var $feedback=_element.find(".panel-feedback");var $data_element=_element.find(".panel-collapse");$feedback.html("");var form_data=[];if($("#create-account").length>0){var create_account_data=$("#create-account").data();$.each(create_account_data,function(key,value){form_data.push({name:key,value:value})})}if($("#payment").length>0){var pay_data=$("#payment").data();$.each(pay_data,function(key,value){form_data.push({name:key,value:value})})}form_data.push({name:"comments",value:$(".cart-comments-field").val()});var custom_fields=["custom1","custom2","custom3","custom4","custom5"];$.each(custom_fields,function(idx,object){if($("#"+object).length>0){form_data.push({name:object,value:$("#"+object).val()})}});cart.pkdcart("request",["update_panel",{panel:this.element.children(".panel-collapse").attr("id"),form_data:form_data},function(){if(this.data.success){if(typeof ga!=="undefined")ga("send","pageview","/order"+($("#payment").data("payment_type")=="PayPal"||$("#payment").data("payment_type")=="Request PayPal"?"PP":"")+".php");else if(typeof _gaq!=="undefined")_gaq.push(["_trackPageview","/order"+($("#payment").data("payment_type")=="PayPal"||$("#payment").data("payment_type")=="Request PayPal"?"PP":"")+".php"]);if(typeof gtag==="function"){gtag("event","page_view",{page_title:"Order Receipt",page_path:"/order"+($("#payment").data("payment_type")=="PayPal"||$("#payment").data("payment_type")=="Request PayPal"?"PP":"")+".php"})}if(typeof _hsq!=="undefined"){_hsq.push(["trackEvent",{id:"checkout-success"+($("#payment").data("payment_type")=="PayPal"||$("#payment").data("payment_type")=="Request PayPal"?"-paypal":"")}])}}if(typeof this.data.redirect!=="undefined"){try{window.location.replace(this.data.redirect)}catch(e){window.location=this.data.redirect}}else{if(_this.callback_finish!=""&&$.isFunction(_this.callback_finish)){_this.callback_finish.call({instance:_instance,data:this.data,element:_element,callback:_this.callback_after_finish!=""&&$.isFunction(_this.callback_after_finish)?_this.callback_after_finish:""})}}},update_payment_panel_error_callback])},onFinish:function(){if(this.callback!=""&&$.isFunction(this.callback)){this.callback.call({instance:this.instance,element:this.element,data:this.data})}},onAfterFinish:function(){var instance=this.instance;var $feedback=this.element.find(".panel-feedback");var $data_element=this.element.find(".panel-collapse");if(this.data.success){var posting=$.post("/checkout.php",{pkdoid:this.data.order_id,is_cim:$data_element.hasClass("cim")&&$("#payment").data("payment_type")=="Credit Card"});posting.done(function(data){$("html,body").animate({scrollTop:"0px"});var content=$(data).find("#checkout-page").parent().html();var print_content=$(data).find("#print-page").html();var main_container=$("#checkout-page").parent();modals.print.html(print_content);main_container.fadeOut(function(){main_container.html(content).fadeIn()})})}else{$feedback.html("").append(this.data.msg.match(/alert(?!\-link)/i)?this.data.msg:''+this.data.msg+"");if("fields"in this.data){$(this.data.fields).addClass("error").parent().parent().addClass("has-error")}if("disconnect"in this.data&&this.data.disconnect){setTimeout(function(){window.location.reload()},7250)}else{instance.submit_btn.button("reset")}}},onNext:function(){var errors_html="";var errors=[];var instance=this.instance;$("#checkout-page").data("checkout_instance",this);var $feedback=this.element.find(".panel-feedback");var $data_element=this.element.find(".panel-collapse");var $panel_completed=this.element.find(".panel-update");$feedback.html("");if($data_element.attr("id")=="payment"){var payment_type=$("input:radio[name=paymentType]:checked").val();$data_element.data("payment_type",payment_type);$("#checkout-page").data("payment_type_label",$("input:radio[name=paymentType]:checked").parent().text());switch(payment_type){case"Gift Card":if($("#token_value").val()==""){errors_html+=''+gift_card_required_error+"
";errors.push($("#checkout-payment-gc"))}var form_data=$(".checkout-billing .form-group *[name]").serializeArray();form_data.push({name:"payment_type",value:payment_type});form_data.push({name:"token_value",value:$("#token_value").val()});break;case"Credit Card":if(!$data_element.hasClass("cim")&&$("#token_value").length<1){var form_data=$(".checkout-billing .form-group *[name]").serializeArray();form_data.push({name:"payment_type",value:payment_type});var cc_error=false;this.element.find(".reqfld").each(function(idx,obj){$(obj).removeClass("error success info warning").parent().parent().removeClass("has-error");if($(obj).val()==""){if(errors.length==0&&$("#fld_exp_month").length>0){errors_html+=""+credit_card_required_error+"
"}errors.push($(this));cc_error=true}});var year=parseInt($("#fld_exp_year").val());var month=parseInt($("#fld_exp_month").val());if(checkDateBeforeToday(new Date(year,month,0))){errors.push($("#fld_exp_year"));errors.push($("#fld_exp_month"));errors_html+=''+credit_card_expired_error+"
";cc_error=true}if(!$('#payment input[name="usfb"]').is(":checked")){this.element.find(".form-control").removeClass("error success info warning").parent().parent().removeClass("has-error");this.element.find(".required:not(div)").each(function(idx,obj){if($(obj).val()==""){if(errors.length==0){errors_html+=""+required_fields_error+"
"}errors.push($(this))}})}if($("#cart-cvv").length>0){var $cvv=$("#cart-cvv");var cvv_value=$cvv.val();var $cc_input=$("#card-number").find(".input-group");var pattern=/\d{3}/;var cvv_error_msg=cart_cvv_error;if($cc_input.hasClass("amex")){cvv_error_msg=cart_cvv_amex_error;pattern=/\d{4}/}if(!cvv_value.match(pattern)){errors_html+=""+cvv_error_msg+"
";errors.push($cvv);cc_error=true}}if(!is_valid){errors.push($cc_num);errors_html+=''+valid_credit_card_error+"
"}else if(!cc_error){var ccnum=$cc_num.val();var ccnum_last4=ccnum.slice(-4);var cc_type=$(".card-number-validator").data("type");$data_element.data("cc_type",cc_type);$data_element.data("ccnum",ccnum);$data_element.data("cc_num_last4",ccnum_last4);$data_element.data("cc_exp_month",$("#fld_exp_month").val());$data_element.data("cc_exp_year",$("#fld_exp_year").val());if(typeof cvv_value!=="undefined"){$data_element.data("cvv",cvv_value)}form_data.push({name:"ccnum",value:ccnum});form_data.push({name:"cc_type",value:cc_type})}}else if($data_element.hasClass("cim")){$panel_completed.data("tpl-completed","tpl.checkout.payment.cim.completed");var form_data=$data_element.find(".active").children('input[type="hidden"]').serializeArray();form_data.push({name:"payment_type",value:payment_type});if($data_element.find(".active").data("payment_profile_id")==null){errors.push($("#checkout-payment-cc"));errors_html+=''+credit_card_select_error+"
"}else{$("#review-order").addClass("cim");if(typeof $data_element.find(".active").data("temp_id")!=="undefined"){$data_element.data("temp_id",$data_element.find(".active").data("temp_id"));$panel_completed.data("tpl-completed","tpl.checkout.payment.completed");$data_element.data("cc_num_last4",$data_element.find(".active").find("#printcc").val());$data_element.data("cc_type",$data_element.find(".active").find("#cc_type").val());$("#review-order").removeClass("cim")}form_data.push({name:"payment_profile_id",value:$data_element.find(".active").data("payment_profile_id")})}}else if($("#token_value").length>0){if(!$('#payment input[name="usfb"]').is(":checked")){if(!$('#payment input[name="usfb"]').is(":checked")){this.element.find(".form-control").removeClass("error success info warning").parent().parent().removeClass("has-error");this.element.find(".required:not(div)").each(function(idx,obj){if($(obj).val()==""){if(errors.length==0){errors_html+=""+required_fields_error+"
"}errors.push($(this))}})}}if($("#token_value").val()==""){errors_html+=''+credit_card_required_error+"
";errors.push($("#checkout-payment-cc"))}if(pkd_gateway=="Square"&&use_3dsecure&&$data_element.data("cc_verification")==null){errors_html+=''+general_cart_error+"
";errors.push($("#checkout-payment-cc"))}var form_data=$(".checkout-billing .form-group *[name]").serializeArray();form_data.push({name:"payment_type",value:payment_type});form_data.push({name:"token_value",value:$("#token_value").val()});if($data_element.data("cc_verification")!=null){form_data.push({name:"verification_token",value:$data_element.data("cc_verification")})}}break;case"Bill to Institution":var form_data=$(".checkout-billing .form-group *[name]").serializeArray();form_data.push({name:"payment_type",value:payment_type});var $po=$('input[name="PONumber"]');if($po.hasClass("po_is_req")){if($po.val()==""){errors.push($po);errors_html+=""+purchase_order_num_error+"
"}}else{if(!$('#payment input[name="usfb"]').is(":checked")){this.element.find(".form-control").removeClass("error success info warning").parent().parent().removeClass("has-error");if(!$('#payment input[name="usfb"]').is(":checked")){this.element.find(".required:not(div)").each(function(idx,obj){if($(obj).val()==""){if(errors.length==0){errors_html+=""+required_fields_error+"
"}errors.push($(this))}})}}}form_data.push({name:"po_num",value:$po.val()});$data_element.data("po_num",$po.val());if($data_element.hasClass("cim")){form_data.push({name:"payment_profile_id",value:0})}if($data_element.hasClass("cim")){$panel_completed.data("tpl-completed","tpl.checkout.payment.completed")}break;case"PayPal":if(braintree_use_paypal){var form_data=[];if($("#token_value").length>0&&$("#token_value").val()!=""){var form_data=[{name:"token_value",value:$("#token_value").val()}];if($("#create-account").length>0||$("#fld_billAddress1").val()==""){form_data.push({name:"usfb",value:""})}}else{errors_html+=""+paypal_general_error+"
";errors.push($("#token_value"))}}else{var form_data=$(".checkout-billing .form-group *[name]").serializeArray();if(!$('#payment input[name="usfb"]').is(":checked")){this.element.find(".form-control").removeClass("error success info warning").parent().parent().removeClass("has-error");this.element.find(".required:not(div)").each(function(idx,obj){if($(obj).val()==""){if(errors.length==0){errors_html+=""+required_fields_error+"
"}errors.push($(this))}})}}form_data.push({name:"payment_type",value:payment_type});break;default:var form_data=$(".checkout-billing .form-group *[name]").serializeArray();form_data.push({name:"payment_type",value:payment_type});if($data_element.hasClass("cim")){form_data.push({name:"payment_profile_id",value:0})}if(!$('#payment input[name="usfb"]').is(":checked")){this.element.find(".form-control").removeClass("error success info warning").parent().parent().removeClass("has-error");this.element.find(".required:not(div)").each(function(idx,obj){if($(obj).val()==""){if(errors.length==0){errors_html+=""+required_fields_error+"
"}errors.push($(this))}})}if($data_element.hasClass("cim")){$panel_completed.data("tpl-completed","tpl.checkout.payment.completed")}break}if($("#billing_save_changes").length>0&&($("#billing_save_changes").attr("type")=="hidden"||$("#billing_save_changes").is(":checked"))){form_data.push({name:"save_changes",value:$("#billing_save_changes").val()})}form_data.push({name:"java_enabled",value:window.navigator.javaEnabled()});form_data.push({name:"color_depth",value:screen.colorDepth});form_data.push({name:"screen_height",value:screen.height});form_data.push({name:"screen_width",value:screen.width});form_data.push({name:"timezone_offset",value:(new Date).getTimezoneOffset()});form_data.push({name:"browser_lang",value:window.navigator.language})}else{this.element.find(".form-control").removeClass("error success info warning").parent().parent().removeClass("has-error");this.element.find(".required:not(div)").each(function(idx,obj){if($(obj).val()==""){errors.push($(this));errors_html=""+required_fields_error+"
"}});if($data_element.attr("id")=="shipping"&&$data_element.hasClass("cim")){var form_data=$data_element.find(".active").children("form").serializeArray();form_data.push({name:"shipping_profile_id",value:$data_element.find(".active").data("shipping_profile_id")})}else if($data_element.attr("id")=="create-account"){if($("#create-username").val()==""&&$("#create-password").val()==""){instance.$wizard_panels[instance.next_active].removeClass("wizard-loading");instance.submit_btn.button("reset");instance.$wizard_panels[instance.active].data("wizard_skip").trigger("click");return 0}$data_element.data("create-username",$("#create-username").val());$data_element.data("create-password",$("#create-password").val());$data_element.data("confirm-create-password",$("#confirm-create-password").val())}}$feedback.html("");if(errors.length>0){$.each(errors,function(idx,obj){$(this).addClass("error").parent().parent().addClass("has-error")});$feedback.append(''+errors_html+"");instance.$wizard_panels[instance.next_active].removeClass("wizard-loading");instance.submit_btn.button("reset");return false}var element=this.element;var skippingPanels=this.skippingPanels;var data={panel:element.children(".panel-collapse").attr("id"),form_data:typeof form_data!=="undefined"?form_data:$data_element.find("form").serializeArray()};cart.pkdcart("request",["update_panel",data,function(){var this_data=this.data;var cart_instance=this.instance;if(typeof this.data.redirect!=="undefined"){try{window.location.replace(this.data.redirect)}catch(e){window.location=this.data.redirect}}if(this.data.success){if($data_element.data("payment_type")=="Gift Card"&&this.data.panels.payment.reload){var payment_msg=this.data.msg;setTimeout(function(){update_payment_panel();$feedback.html(payment_msg);cart_instance.update_values();instance.$wizard_panels[instance.next_active].removeClass("wizard-loading");instance.submit_btn.button("reset");var review_update=$("#review-order").find(".panel-update");review_update.ajax_template({tpl:review_update.data("tpl-reload")})},4200);return true}if(typeof ga!=="undefined")ga("send","event","Cart","checkout-"+data.panel);else if(typeof _gaq!=="undefined")_gaq.push(["_trackEvent","Cart","checkout-"+data.panel]);if(typeof gtag==="function"){gtag("event","checkout-"+data.panel,{event_category:"Cart"})}if(typeof _hsq!=="undefined"){_hsq.push(["trackEvent",{id:"checkout-"+data.panel}])}if($panel_completed.data("tpl-completed")!=="undefined"){var tpl_complete_data={tpl:$panel_completed.data("tpl-completed")};$panel_completed.ajax_template(tpl_complete_data,function(){instance.$wizard_panels[instance.active].removeClass("wizard-active wizard-todo").addClass("wizard-complete wizard-completed");if($panel_completed.data("tpl-completed")=="tpl.checkout.payment.completed"||$panel_completed.data("tpl-completed")=="tpl.checkout.payment.ship_exempt.completed"){$("#payment_type").text($("#checkout-page").data("payment_type_label")!=""?$("#checkout-page").data("payment_type_label"):$data_element.data("payment_type"));switch($data_element.data("payment_type")){case"Credit Card":if($("#payment_type_info").length>0){$("#payment_type_info").html(''+$data_element.data("cc_type")+" "+cart_cc_ending_in_text+" "+$data_element.data("cc_num_last4")+(typeof $data_element.data("cc_exp_month")!=="undefined"||typeof $data_element.data("cc_exp_year")!=="undefined"?"
")}break;case"Bill to Institution":if($("#payment_type_info").length>0){var po_number=escapeHtml($data_element.data("po_num"));$("#payment_type_info").html("
"+expires_text+" "+(typeof $data_element.data("cc_exp_month")!=="undefined"?$data_element.data("cc_exp_month")+"/":"")+(typeof $data_element.data("cc_exp_year")!=="undefined"?$data_element.data("cc_exp_year"):""):"")+""+po_number_text+": "+po_number+"
")}break}}else if($panel_completed.data("tpl-completed")=="tpl.checkout.create_account.completed"){if($("#account-info").length>0){var pass=$data_element.data("create-password");var str_pass=pass.replace(/./g,"*");$("#account-info").html(""+$data_element.data("create-username")+"
")}}cart_instance.update_values();$("#cart-summary").ajax_template($("#cart-summary").data(),function(){checkCartSummary();if(typeof this_data.panels!=="undefined"&&this_data.panels!=""){var panels=[];$.each(this_data.panels,function(id,actions){if(actions.reload){var $update=$("#"+id).find(".panel-update");panels.push({panel:$update,tpl:$update.data("tpl-reload")})}});if(panels.length>0){if(skippingPanels){if(panels.length>1){panels[1].panel.ajax_template(panels[1],function(){if(panels.length>2){panels[2].panel.ajax_template(panels[2],function(){instance.next_panel()})}else{instance.next_panel()}})}else{instance.next_panel()}}else{panels[0].panel.ajax_template(panels[0],function(){if(panels.length>1){panels[1].panel.ajax_template(panels[1],function(){if(panels.length>2){panels[2].panel.ajax_template(panels[2],function(){instance.next_panel()})}else{instance.next_panel()}})}else{instance.next_panel()}})}}}else{instance.next_panel()}})})}}else{$feedback.html("").append(this.data.msg.match(/alert(?!\-link)/i)?this.data.msg:'
"+str_pass+"'+this.data.msg+"");$(this.data.fields).addClass("error").parent().parent().addClass("has-error");instance.$wizard_panels[instance.next_active].removeClass("wizard-loading");if("disconnect"in this.data&&this.data.disconnect){setTimeout(function(){window.location.reload()},6200)}else{instance.submit_btn.button("reset")}}},function(){update_payment_panel_error_callback();if($("#shipping-options .alert-danger").length>0){$("#cart-payform").html("");$("#payment-label .wizard-change").remove()}}])},onNextAfter:function(){var $data_element=this.element.find(".panel-collapse");if($data_element.attr("id")=="payment"){checkUSFB();checkRadio();pkd_init_card_validator();if($(".fld-state").length>0){state_required=$(".fld-state").hasClass("required")}checkCountry($(".fld-country"),false);if($("#token_value").length>0){if(window.Square){init_square_payment_form()}if(typeof braintree!=="undefined"){init_braintree_payment_form()}}}if(typeof cart_panel_update==="function"){cart_panel_update($data_element.attr("id"),"next")}}});$("body").tooltip({selector:".cart-line-item a, .tooltip-link",container:"body"});$("#checkout-page").on("click",".use-shipping-address",function(){$(".address-card .well").removeClass("active");$(this).addClass("active").parent().parent().removeClass("error")});$("#checkout-page").on("click",".use-payment-profile",function(){$(".payment-card .well").removeClass("active");$(this).addClass("active").parent().parent().removeClass("error")});modals.login=$("#login_modal");$("#main-content").on("click",".ajax-login",function(event){event.preventDefault();modals.login.ajax_template({tpl:"tpl.acct.modal.login"},function(){modals.login.modal("show")})});$(document).on("submit","#checkout-new-customer-form",function(){var $form=$(this);var errors_html="";var errors=[];$form.find(".alert").remove();$form.find(".required").each(function(idx,obj){$(obj).removeClass("error success info warning").parent().parent().removeClass("has-error");if($(obj).val()==""){errors.push($(this));errors_html=""+required_fields_error+"
"}});if(errors.length>0){$.each(errors,function(idx,obj){$(this).addClass("error").parent().parent().addClass("has-error")});$form.prepend(''+errors_html+"");return false}});$(document).on("submit","#checkout-returning-customer-form, #capture-customer-form",function(){var $form=$(this);var errors_html="";var errors=[];var $submit_btn=$form.find(".form-actions").children(".btn").button("loading");var form_data=$form.serializeArray();$form.find(".alert").remove();$form.find(".required").each(function(idx,obj){$(obj).removeClass("error success info warning").parent().parent().removeClass("has-error");if($(obj).val()==""){errors.push($(this));errors_html=""+required_fields_error+"
"}});if(errors.length>0){$.each(errors,function(idx,obj){$(this).addClass("error").parent().parent().addClass("has-error")});$form.prepend(''+errors_html+"");$submit_btn.button("reset");return false}$.ajax({type:"POST",url:pkd_loc.httppath+"manager/include/ajax_call.php",data:"a_func=pkd_login_user&a_params="+JSON.stringify(form_data),success:function(raw_data){var data=jQuery.parseJSON(raw_data);if(data.success){window.location.href=pkd_loc.httppath+(!pkd_is_payment_page?"checkout.php":"payment.php")}else{$form.prepend(data.msg);$submit_btn.button("reset")}}});return false})});var $wizard;function checkRadio(val){var checkObj=$("input:radio[name=paymentType]:checked");if(typeof val!=="undefined"){$('input:radio[value="'+val+'"]').prop("checked",true)}var val=val||checkObj.val();var pay_type=val;var checkObjParent=checkObj.closest(".panel-collapse");var hasGiftCards=false;$("input:radio[name=paymentType]").each(function(){if($(this).val()=="Gift Card"){hasGiftCards=true}});if(val=="Gift Card"){$(".checkout-payment-left").addClass("billing-addr-full-width");$(".checkout-payment-right").fadeOut("fast",function(){$("#checkout-payment-gc").fadeIn("fast")})}else if(hasGiftCards){$(".checkout-payment-right").fadeIn("fast",function(){$(".checkout-payment-left").removeClass("billing-addr-full-width");$("#checkout-payment-gc").fadeOut("fast")})}if(val=="Credit Card"){pkd_init_card_validator();if(checkObjParent.hasClass("cim")){$(".cim-hide").fadeOut();$(".checkout-payment-left").addClass("billing-addr-full-width")}$("#checkout-payment-cc").fadeIn("fast")}else{if(checkObjParent.hasClass("cim")){$(".cim-hide").fadeIn();$(".checkout-payment-left").removeClass("billing-addr-full-width")}$("#checkout-payment-cc").fadeOut("fast")}if(val=="Bill to Institution"){$("#checkout-payment-po").fadeIn("fast")}else{$("#checkout-payment-po").fadeOut("fast")}if(braintree_use_paypal){if(val=="PayPal"){$("#checkout-payment-paypal").removeClass("hide");$(".checkout-payment-right").fadeOut("fast");$("#payment .wizard-actions").addClass("hide")}else{$("#checkout-payment-paypal").addClass("hide");$(".checkout-payment-right").fadeIn("fast");$("#payment .wizard-actions").removeClass("hide")}}if(pkd_is_payment_page){if(val=="PayPal"){$("#checkout-payment-paypal").removeClass("hide")}else{$("#checkout-payment-paypal").addClass("hide")}}if(val=="Check/Money Order"||val=="PayPal"||val=="Request PayPal"||val=="Bank Transfer"||val=="N/A"){$(".checkout-payment-left").fadeOut("fast")}else{$(".checkout-payment-left").fadeIn("fast")}}function checkUSFB(){if($('#payment input[name="usfb"]').is(":checked")){$(".form-group-hide").fadeOut()}else{$(".form-group-hide").fadeIn()}}function checkCountry(obj,changeState){var $this=$(obj);var val=$this.val();if(val==""||val=="??")return;var $form=$this.closest("form");var $province=$form.find(".fld-province");var $state=$form.find(".fld-state");if(val=="US"){$province.val("n/a");$province.prop("disabled",true);if(state_required){$province.removeClass("required");$province.parent().parent().find(".req_fld").html("");$state.addClass("required");$state.parent().parent().find(".req_fld").html("*")}$state.prop("disabled",false);if(changeState){$state.prop("selectedIndex",0)}}else{if(changeState){$province.val("")}$province.removeAttr("disabled");if(state_required){$province.parent().parent().find(".req_fld").html("");$state.removeClass("required");$state.parent().parent().find(".req_fld").html("")}$state.prop("selectedIndex",1);$state.prop("disabled",true)}if(typeof refresh_custom_select=="function"){refresh_custom_select()}}function checkCartSummary(){var summary_toggle=$("#cart-summary").data("cart-toggle")||"closed";if(summary_toggle=="open"){$(".cart-toggle").addClass("active");$("#cart-summary-items-inner").slideDown()}}function checkPageForItemErrors(){return $("#checkout-page").hasClass("checkout-has-error")}function checkForItemErrors(){if(checkPageForItemErrors()){modals.edit_cart.ajax_template({tpl:"tpl.cart.v2.modal.edit_cart"},function(){edit_items_modal_callback(true)})}}function edit_items_modal_callback(hasPageErrors){hasPageErrors=hasPageErrors||false;if(hasPageErrors||checkPageForItemErrors()){$(".cart-checkout").addClass("disabled");modals.edit_cart.modal({backdrop:"static"})}modals.edit_cart.modal("show");if(typeof $edit_cart_btn!=="undefined"){$edit_cart_btn.button("reset")}}function checkDateBeforeToday(date){return new Date(date.toDateString())0){if(skippingPanels){if(panels.length>1){panels[1].panel.ajax_template(panels[1],function(){if(panels.length>2){panels[2].panel.ajax_template(panels[2],function(){instance.next_panel()})}else{instance.next_panel()}})}else{instance.next_panel()}}else{panels[0].panel.ajax_template(panels[0],function(){if(panels.length>1){panels[1].panel.ajax_template(panels[1],function(){if(panels.length>2){panels[2].panel.ajax_template(panels[2],function(){instance.next_panel()})}else{instance.next_panel()}})}else{instance.next_panel()}})}}}else{instance.next_panel()}})}}else{$feedback.html("").append(' '+this.data.msg+"");$(this.data.fields).addClass("error").parent().parent().addClass("has-error");instance.$wizard_panels[instance.next_active].removeClass("wizard-loading");if(typeof grecaptcha!=="undefined"){grecaptcha.reset()}instance.submit_btn.button("reset")}},update_payment_panel_error_callback])};function update_payment_panel(){$("#cart-summary").ajax_template($("#cart-summary").data(),function(){checkCartSummary();var $panel_reload=$("#payment").find(".panel-update");$panel_reload.ajax_template({tpl:$panel_reload.data("tpl-reload")},function(){checkUSFB();checkRadio($("input:radio[name=paymentType]:checked").val());if(window.Square){init_square_payment_form()}if(typeof braintree!=="undefined"){init_braintree_payment_form()}var $change_ele=$("#payment");if($change_ele.data("payment_type")=="Bill to Institution"){$('input[name="PONumber"]').val($change_ele.data("po_num"))}if($(".fld-state").length>0){state_required=$(".fld-state").hasClass("required")}checkCountry($(".fld-country"),false)})})}function update_payment_panel_error_callback(){$(".wizard-loading").removeClass("wizard-loading");$(".wizard-active .wizard-actions .wizard-finish").button("reset");$("#checkout-page").addClass("checkout-has-error");modals.edit_cart.ajax_template({tpl:"tpl.cart.v2.modal.edit_cart"},function(){edit_items_modal_callback(true)})}function pkd_remove_item_success(data){if(typeof gtag==="function"){gtag("event","remove_from_cart",{currency:data.currency,value:data.subtotal,items:data.items})}}function pkd_add_item_success(data){if(typeof gtag==="function"){gtag("event","add_to_cart",{currency:data.currency,value:data.subtotal,items:data.items})}} $.fn.extend({pkd_payment_form:function(feedback,callback,callback_validation){var form=this;var pkdDataForm={required:$(form).find(".required"),feedback:typeof feedback!="undefined"&&feedback!=""?$(feedback):$(form).find('[class*="feedback"]'),ajaxFunc:typeof $(form).data("pkdform-func")!="undefined"?$(form).data("pkdform-func"):"",data:"",submit_button:$("#payment-submit"),action:typeof $(form).data("action")!="undefined"?$(form).data("action"):""};var callback=typeof callback!=="undefined"&&$.isFunction(callback)?callback:null;var callback_validation=typeof callback_validation!=="undefined"&&$.isFunction(callback_validation)?callback_validation:null;var form_pass=$.isEmptyObject(pkdDataForm.required)?false:true;var errors=[];var errors_html="";pkdDataForm.submit_button.on("click",function(e){e.preventDefault();pkdDataForm.feedback.html("");errors_html="";pkdDataForm.submit_button.button("loading");pkdDataForm.required=$(form).find(".required");$.each(pkdDataForm.required,function(){$(this).removeClass("error success info warning").parent().parent().removeClass("has-error");if($(this).val()==""){errors_html=""+required_fields_error+"
";errors.push($(this));form_pass=false}});$(form).data("form_pass",form_pass);$(form).data("form_errors",errors);$(form).data("form_errors_html",errors_html);if(callback_validation!=null&&form_pass){callback_validation.call({data_form:pkdDataForm,the_form:form,action:pkdDataForm.ajaxFunc})}else{$(form).submit()}return false});$(form).submit(function(e){var $to_scroll=$("html,body");var form_pass_final=$(this).data("form_pass_final")||false;if(!form_pass_final){if($(this).data("form_pass")){if(pkdDataForm.action!=""){$(this).attr("action",pkdDataForm.action)}if(pkdDataForm.ajaxFunc!=""){e.preventDefault();pkdDataForm.data=$(form).serializeArray();pkdDataForm.data.push({name:"java_enabled",value:window.navigator.javaEnabled()});pkdDataForm.data.push({name:"color_depth",value:screen.colorDepth});pkdDataForm.data.push({name:"screen_height",value:screen.height});pkdDataForm.data.push({name:"screen_width",value:screen.width});pkdDataForm.data.push({name:"timezone_offset",value:(new Date).getTimezoneOffset()});pkdDataForm.data.push({name:"browser_lang",value:window.navigator.language});if(typeof grecaptcha!=="undefined"){pkdDataForm.data.push({name:"g-recaptcha-response",value:grecaptcha.getResponse()})}var data=JSON.stringify(pkdDataForm.data);$.ajax({type:"POST",url:"manager/include/ajax_cart.php",data:"a_func="+pkdDataForm.ajaxFunc+"&a_params="+encodeURIComponent(data),success:function(data){var rspns=$.parseJSON(data);if(rspns.success){if(pkdDataForm.ajaxFunc=="donate"){if(typeof ga!=="undefined")ga("send","pageview","/donate.php");else if(typeof _gaq!=="undefined")_gaq.push(["_trackPageview","/donate.php"]);if(typeof _hsq!=="undefined"){_hsq.push(["trackEvent",{id:"donate-success"}])}}else{if(typeof ga!=="undefined")ga("send","pageview","/payment.php");else if(typeof _gaq!=="undefined")_gaq.push(["_trackPageview","/payment.php"]);if(typeof _hsq!=="undefined"){_hsq.push(["trackEvent",{id:"payment-success"}])}}if(typeof rspns.redirect!=="undefined"){try{window.location.replace(rspns.redirect)}catch(e){window.location=rspns.redirect}}else{if(callback!==null){var form_callback_pass=callback.call({form:pkdDataForm,data:rspns})}else{pkdDataForm.submit_button.button("reset")}if(callback===null||(typeof form_callback_pass!=="undefined"?form_callback_pass.hasOwnProperty("submit_form")?form_callback_pass.submit_form:false:true)){var req_data=query_string_to_json();req_data.pkdpoid=rspns.payment_id;if(pkdDataForm.ajaxFunc=="donate"){var posting=$.post("/donate.php",req_data)}else{var posting=$.post("/payment.php",req_data)}posting.done(function(post_data){$("html,body").animate({scrollTop:"0px"});var content=$(post_data).find("#payment-page").parent().html();var print_content=$(post_data).find("#print-page").html();var main_container=$("#payment-page").parent();modals.print.html(print_content);main_container.fadeOut(function(){main_container.html(content).fadeIn()})})}}}else{pkdDataForm.feedback.html(''+rspns.msg+"").fadeIn().removeClass("hidden");$to_scroll.animate({scrollTop:pkdDataForm.feedback.position().top},"slow");pkdDataForm.submit_button.button("reset");if(typeof grecaptcha!=="undefined"){grecaptcha.reset()}}},error:function(){pkdDataForm.feedback.html(''+general_ajax_error+"").fadeIn().removeClass("hidden");$to_scroll.animate({scrollTop:pkdDataForm.feedback.position().top},"slow");pkdDataForm.submit_button.button("reset");if(typeof grecaptcha!=="undefined"){grecaptcha.reset()}}})}}else{pkdDataForm.submit_button.button("reset");if(typeof grecaptcha!=="undefined"){grecaptcha.reset()}var errors_html=$(this).data("form_errors_html");var fin_errors=$(this).data("form_errors");if(fin_errors.length>0||errors_html!=""){if(fin_errors.length>0){$.each(fin_errors,function(idx,obj){$(this).addClass("error").parent().parent().addClass("has-error")})}if(errors_html!=""){pkdDataForm.feedback.html(''+errors_html+"");$to_scroll.animate({scrollTop:pkdDataForm.feedback.position().top},"slow")}}form_pass=true}}else{if(pkdDataForm.ajaxFunc=="donate"){var posting=$.post("/donate.php",{pkdpoid:$(this).data("payment_id")})}else{var posting=$.post("/payment.php",{pkdpoid:$(this).data("payment_id")})}posting.done(function(post_data){$("html,body").animate({scrollTop:"0px"});var content=$(post_data).find("#payment-page").parent().html();var print_content=$(post_data).find("#print-page").html();var main_container=$("#payment-page").parent();modals.print.html(print_content);main_container.fadeOut(function(){main_container.html(content).fadeIn()})})}return false})}});function pkd_payment_validation(){var the_form=this.the_form;var data_form=this.data_form;var action=this.action;var gateway_capture=typeof pkd_payment_gateway_capture!=="undefined"&&$.isFunction(pkd_payment_gateway_capture);var payment_errors_html="";var payment_errors=[];var amount=$("#opamt").val();if(isNaN(amount)){payment_errors.push($("#opamt"));payment_errors_html="Please enter a valid amount.
"}if(!gateway_capture){if($("input:radio[name=paymentType]:checked").val()=="Credit Card"){var cc_error=false;$("#checkout-billing-wrapper").find(".reqfld").each(function(idx,obj){$(obj).removeClass("error success info warning").parent().parent().removeClass("has-error");if($(obj).val()==""){payment_errors.push($(this));cc_error=true}});if(cc_error){payment_errors_html+=""+credit_card_required_error+"
"}if(!is_valid){payment_errors.push($cc_num);payment_errors_html+=''+valid_credit_card_error+"
"}if($("#cart-cvv").length>0){var $cvv=$("#cart-cvv");$cvv.removeClass("error").parent().parent().removeClass("has-error");var cvv_value=$cvv.val();var $cc_input=$("#card-number").find(".input-group");var pattern=/\d{3}/;var cvv_error_msg=cart_cvv_error;if($cc_input.hasClass("amex")){cvv_error_msg=cart_cvv_amex_error;pattern=/\d{4}/}if(!cvv_value.match(pattern)){payment_errors_html+=""+cvv_error_msg+"
";payment_errors.push($cvv);cc_error=true}}}}if(payment_errors.length>0){the_form.data("form_pass",false);the_form.data("form_errors",payment_errors);the_form.data("form_errors_html",payment_errors_html);the_form.submit();return false}amount=parseFloat(amount);amount=amount.truncateToDecimals(2);$("#opamt").val(amount);var pkd_message=""+sprintf(payment_form_confirm,currencyFormatter.format(amount))+"
";bootbox.confirm({size:"sm",onEscape:true,buttons:{confirm:{label:bootbox_confirm_label,className:"btn-success"},cancel:{label:bootbox_cancel_label,className:"btn-danger"}},message:pkd_message,callback:function(result){if(result){if(gateway_capture){pkd_payment_gateway_capture(the_form)}else{the_form.submit()}}else{data_form.submit_button.button("reset")}}})}$(function(){if($("#payment-form").length>0){var pkd_payment_callback=null;if(typeof pkd_payment_before_finish!=="undefined"){pkd_payment_callback=pkd_payment_before_finish}$("#payment-form").pkd_payment_form($("#payment-page > .payment-response"),pkd_payment_callback,pkd_payment_validation)}}); var accentMap = { 'Â':'A', 'Ã':'A', 'Ä':'A', 'À':'A', 'Á':'A', 'Å':'A', 'Æ':'AE', 'È':'E', 'É':'E', 'Ê':'E', 'Ë':'E', 'Ì':'I', 'Í':'I', 'Î':'I', 'Ï':'I', 'Ò':'O', 'Ó':'O', 'Ô':'O', 'Õ':'O', 'Ö':'O', 'Ø':'O', 'Ù':'U', 'Ú':'U', 'Û':'U', 'Ü':'U', 'à':'a', 'á':'a', 'â':'a', 'ã':'a', 'ä':'a', 'å':'a', 'æ':'ae', 'è':'e', 'é':'e', 'ê':'e', 'ë':'e', 'ì':'i', 'í':'i', 'î':'i', 'ï':'i', 'ð':'o', 'ò':'o', 'ó':'o', 'ô':'o', 'õ':'o', 'ö':'o', 'ø':'o', 'ù':'u', 'ú':'u', 'û':'u', 'ü':'u', 'ñ':'n', 'ý':'y', 'þ':'th', 'ÿ':'y', 'Ç':'C', 'ç':'c', 'Ð':'D', 'Ñ':'N', 'Ý':'Y', 'Þ':'th', 'ß':'ss' }; var normalize = function( term ) { var ret = ""; for ( var i = 0; i < term.length; i++ ) { ret += accentMap[ term.charAt(i) ] || term.charAt(i); } return ret; }; custom_title_src = function(item){ var title = item.el.attr('title'); return title.replace('[newline]', '
'); }; $.fn.extend({ expandCategory: function(toggleNow) { var toggle = toggleNow || false; this.each(function() { $(this).click(function(e){ $a = $(this); $expand = $a.children("span.expand"); $li = $(this).closest("li"); $ul = $li.children("ul"); if($ul.length > 0) { e.preventDefault(); $ul.slideToggle(800, 'swing', function(){ var reltag = $expand.text(); $expand.text($expand.attr("rel")); $expand.attr("rel", reltag); }); } }); if(toggle) { $(this).trigger('click'); } }); }, pkdDataSignup: function (feedback) { this.each(function() { if($(this).length > 0) { $(this).submit(function (e) { e.preventDefault(); //set some form html objects $form = $(this); //this form $fields = $(this).find(".form-control"); //this form's fields, minus the lists $submit_btn = $form.find('button[type="submit"]'); //this form's submit button $lists_wrapper = $form.find('.widget-signup-lists'); $lists = $lists_wrapper.find('input,select'); //this form's lists, checkbox, select, or hidden input //feedback for signup $feedback = (typeof feedback != "undefined" ? $(feedback) : $("#widget_cc_email_box_message1")); //get the selected list(s) var selected_list = ''; if($lists_wrapper.length > 0) { selected_list = ''; $lists.each(function(idx, list){ this_list = $(list); if(this_list.is(":checked") || this_list.is(":selected")) { if(selected_list != '') selected_list += ", "; selected_list += this_list.val(); } else if(this_list.attr("type") == 'hidden') { selected_list = this_list.val(); } }); } //reset error and feedback states $feedback.html("").hide(); $(".has-error").removeClass("has-error"); var errors = {}; //reset form parameters var emailparams = ""; //set button into loading state $submit_btn.button('loading'); $fields.each(function(idx, val){ $fld = $(val); var fld_isRequired = $fld.hasClass('required'); var fld_val = $fld.val(); if( fld_isRequired && $.trim(fld_val) == "" ) { if($.isEmptyObject(errors)) errors = new Array(); $fld.parent().addClass("has-error"); errors.push($fld); } }); //handle error case if no lists are selected if(selected_list == '' && $lists_wrapper.length > 0 ) { if($.isEmptyObject(errors)) errors = new Array(); errors.push($lists_wrapper); $lists_wrapper.addClass('has-error'); } else { $lists_wrapper.removeClass('has-error'); } //If email address or required fields are empty don't bother calling ajax //instead print out a not so nice message to enter all required fields if($.isEmptyObject(errors)) { emailparams = encodeURIComponent( $form.serialize() ); var widget_id = $form.data('widget-id'); var name = $('#signup_firstname').val() + " " + $('#signup_lastname').val(); $.ajax({ type: "POST", url: "/manager/include/ajax_call.php", data: "a_func=widget_constantcontact_subscribe&a_params=" + emailparams +'|'+selected_list+'|'+widget_id+'|'+name, success: function (data) { //Returns an array(success=>true/false, msg) var response = jQuery.parseJSON(data); $(".has-error").removeClass("has-error"); //If the email was successfully added then hide form and print out nice message //Otherwise, print out a not so nice message telling them they signed up wrong if(response.success) { $form.fadeOut(function () { $feedback.html(''+response.msg+'').fadeIn("fast"); }); } else { if( $.trim(response.fields) != "" ) { var new_errors = []; $.each(response.fields, function(idx,val) { $fld = $("#"+val); new_errors.push($fld); $fld.parent().addClass("has-error"); }); new_errors[0].focus(); } $feedback.html(''+response.msg+'').fadeIn("fast"); } }, complete: function() { $submit_btn.button('reset'); $('html, body').animate({ scrollTop: $feedback.offset().top - 20 }, 600); } }); } else { $feedback.html('Please fill in required fields.').fadeIn("fast", function(){ $submit_btn.button('reset'); errors[0].focus(); $('html, body').animate({ scrollTop: $feedback.offset().top - 20 }, 600); }); return false; } }); } }); }, pkdDataForm: function (feedback) { var form = this; var pkdDataForm = { 'required':$(form).find('.required'), 'feedback':(typeof feedback != "undefined" ? $(feedback) : $(form).find('[class*="feedback"]')), 'ajaxFunc': $(form).data('pkdform-func'), 'data': '', 'submit_button': $(form).find('button[type="submit"]') } var form_pass = ($.isEmptyObject(pkdDataForm.required) ? false:true); $(this).submit(function (e) { e.preventDefault(); pkdDataForm.data = $(form).serializeArray(); // serialize array to grab current form values //console.log(pkdDataForm.data); pkdDataForm.feedback.html(""); $.each(pkdDataForm.required, function() { if($(this).val() == '') { //console.log ('failed check - resetting to false: '+$(this).attr('id')) form_pass = false; } }); if( form_pass ) { if(pkdDataForm.ajaxFunc == "") { pkdDataForm.feedback.append('Oops, something went wrong.').fadeIn().removeClass('hidden'); } else { var data = JSON.stringify(pkdDataForm.data); pkdDataForm.submit_button.button('loading'); $.ajax({ type: "POST", url: "manager/include/ajax_call.php", data: "a_func=" + pkdDataForm.ajaxFunc + "&a_params=" + data, success: function (data) { var rspns = $.parseJSON(data); pkdDataForm.submit_button.button('reset'); //console.log("Success: " + rspns.success); //console.log("Html: " + rspns.html); pkdDataForm.feedback.append(rspns.html).fadeIn().removeClass('hidden'); }, error: function(data) { pkdDataForm.submit_button.button('reset'); } }); } } else { pkdDataForm.feedback.append('Oops, please fill in required fields.').fadeIn().removeClass('hidden'); //console.log("1" + form_pass); form_pass = true; // Reset to true to prevent failure on second submission //console.log("2" + form_pass); return false; } }); } }); function add_to_cart_callback() { if(typeof window._fbq !== 'undefined') { window._fbq.push(['track', '6038807647292', {'value':'0.00','currency':'USD'}]); } } function valign_carousel_images() { $('.carousel-content').each(function(){ //alert($(this).index()); $img = $(this).find('img'); var ccheight = $(this).actual( 'height' ); var ciheight = $img.actual( 'height' ); if(ciheight < ccheight) { var newheight = ((ccheight - ciheight) / 2) + 'px'; $img.css('padding-top', newheight); $img.css('padding-bottom', newheight); } }); } function init_gallery_sidebar_events(){ $('.gallery #left-sidebar .widget-nav-menu .widget-content>ul>li, .gallery #left-sidebar .widget-nav-menu .widget-content>ul>li>ul>li').each(function() { init_gallery_sidebar_event($(this)); }); } function init_gallery_sidebar_event($_this){ $_this.children(".open-menu").on('click', function (e) { e.stopImmediatePropagation(); e.preventDefault(); var $parent = $(this).parent(); var link = $parent.children('a'); if(!link.hasClass('open-modal')) { var $ul = $(this).parent().children('ul'); if ($ul.is(":visible")) { $ul.slideUp(); $(this).children('i').removeClass('fa-minus-square').addClass('fa-plus-square'); } else { $ul.slideDown(); $(this).children('i').removeClass('fa-plus-square').addClass('fa-minus-square'); } } else { link.trigger('click'); } }); $_this.children(".open-modal").on('click', function (e) { e.stopImmediatePropagation(); e.preventDefault(); var $parent = $(this).parent(); var $bigParent = $parent.closest('.widget-group'); var titleDiv = $bigParent.find('.header-span-level-1'); var titleAppend = ''; if(titleDiv.length > 0) { if(titleDiv.text() != 'Series') { titleAppend = " in " + titleDiv.text(); } } var title = $(this).text(); var menu = $parent.find('ul').html(); modals.series = $("#lyr-series"); if($(this).hasClass('open-modal-authors')) { $("#lyr-series #modal-title").text(title); $("#lyr-series .modal-body").html("" + menu + "
"); } else { $("#lyr-series #modal-title").text(title + titleAppend); $("#lyr-series .modal-body").html("" + menu + "
"); } modals.series.modal('show'); }); } function init_gallery_sidebar(){ if($(list).length > 0) { $('.gallery #left-sidebar .widget-nav-menu .widget-content>ul>li, ' + '.gallery #left-sidebar .widget-nav-menu .widget-content>ul>li>ul>li, ' + '#left-sidebar .category-list>ul>li, ' + '#left-sidebar .category-list>ul>li>ul>li').each(function(){ var $_this = $(this); var $tul = $_this.children('ul'); var $check_parent = $_this.closest('.widget-category-list'); if($tul.length > 0) { if($tul.find('.active').length > 0 && !$check_parent.hasClass('widget-category-list-authors')) { //console.log($tul.find('.active').find('.category-list-open').attr('class')); if(!$tul.find('.active').find('.category-list-open').hasClass('open-modal')) { //alert('something should be active'); $tul.show(); } } if($_this.children('ul').is(":visible")) { $_this.prepend(' '); } else { $_this.prepend(' '); } } init_gallery_sidebar_event($_this); }); if($('.open-modal-authors').hasClass('active')) { $('.category-list-all-books a').removeClass('active'); } old_list = $(list).html(); } } // recursive function to search for the string in all the children function search_child(search_list) { var $list = search_list || $(list); // for every children, do function $list.children('li').each(function () { var $_this = $(this); var $tul = $_this.find('ul :first'); if(search_filter != '') { // see if the list contains the filter //console.log("[filter-search] Looking for '" + search_filter + "'"); if ($(this).find("a:contains(" + search_filter + ")").length > 0) { // see if it has nested levels //console.log('[filter-search] [Found] ' + search_filter + " in " + $_this.attr('class')); if ($tul.length > 0) { //show this one and open the parent $_this.addClass('filter-show').parent().addClass('filter-show'); // search function for all children search_child($tul.parent()); //change ui to close $_this.find('.open-menu').children('i').attr('class', 'fa fa-minus-square'); } else { //show this one and open the parent $_this.addClass('filter-show').parent().addClass('filter-show'); } } else { //console.log('[filter-search] [Not Found] ' + search_filter + " in " + $_this.attr('class')); //only hide the actual li, in case we have others in the li that are found $_this.addClass('filter-hide'); //change ui to open $_this.find('.open-menu').children('i').attr('class', 'fa fa-plus-square'); } } if(search_tokens.length > 0) { $.each(search_tokens, function(index, tokens){ var key = Object.keys(tokens); var tokens_obj = tokens[key]; if('tokens' in tokens_obj && tokens_obj.tokens.length > 0) { $.each(tokens_obj.tokens, function(idx, token) { //console.log('[token-search] Looking for .chronology-' + token + " in '" + $_this.attr('class') + "'"); if( $_this.find('.chronology-' + token).length > 0 || $_this.hasClass('chronology-' + token) ) { //console.log('[token-search] [Found] ' + $_this.attr('class')); // see if it has nested levels if ($tul.length > 0) { //show this one and open the parent $_this.addClass('token-show').parent().addClass('token-show'); // search function for all children search_child($tul.parent()); //change ui to close $_this.find('.open-menu').children('i').attr('class', 'fa fa-minus-square'); } else { //show this one and open the parent $_this.addClass('token-show').parent().addClass('token-show'); } } else { //console.log('[token-search] [Not Found] ' + $_this.attr('class')); //only hide the actual li, in case we have others in the li that are found $_this.addClass('token-hide'); //change ui to open $_this.find('.open-menu').children('i').attr('class', 'fa fa-plus-square'); } }); } }); } }); } var search_filter = ''; var search_tokens = new Array(); function createtoken_callback(e) { //check that we're not selecting an existing token var existingTokens = $(this).tokenfield('getTokens'); $.each(existingTokens, function(index, token) { if (token.value === e.attrs.value) { e.preventDefault(); } }); //if we have an actual match if('id' in e.attrs ) { //let it be added } else { //if we don't have an actual match //not allowed to be added e.preventDefault(); } } function createdtoken_callback(e) { //add to the tokens array //if we've passed validation of token //set all the tokens var tokens = [e.attrs.id]; //set the children tokens if we have them if('children' in e.attrs) { if(e.attrs.children != '') { var children = e.attrs.children.split(","); $.each(children, function(idx, val){ tokens.push($.trim(val)); }); } } var token = {}; token[e.attrs.id] = {tokens:tokens}; search_tokens.push(token); $('#left-sidebar').find('.token-show').removeClass('token-show'); $('#left-sidebar').find('.token-hide').removeClass('token-hide'); search_child(); check_for_empty_results(); } function removedtoken_callback(e) { var to_remove = undefined; //remove token from our tokens array $.each(search_tokens, function(index,tokens) { var key = Object.keys(tokens); if(typeof tokens[e.attrs.id] !== 'undefined') { to_remove = index; //console.log('[token-search] [REMOVE] ' + to_remove); return false; } }); if(typeof to_remove !== 'undefined') { search_tokens.splice(to_remove, 1); } if(search_tokens.length > 0 || search_filter != '') { $('#left-sidebar').find('.token-show').removeClass('token-show'); $('#left-sidebar').find('.token-hide').removeClass('token-hide'); search_child(); check_for_empty_results(); } else { reset_gallery_search(); } } function reset_gallery_search(){ // revert column back to the old list $(list).html(old_list); //remove alerts reset_empty_results(); //init the events init_gallery_sidebar_events(); } function reset_empty_results(menu_container) { var $nav_menu_container = menu_container || $("#left-sidebar").children('.widget-nav-menu').children('.widget-content'); //remove all alerts before looking for more $nav_menu_container.find('.alert-info').remove(); } function check_for_empty_results() { var $nav_menu_container = $("#left-sidebar").children('.widget-nav-menu').children('.widget-content'); //remove all alerts before looking for more reset_empty_results($nav_menu_container); //if we there are no children or the height is less than 1 if($nav_menu_container.length > 0 && $nav_menu_container.children('ul').height() < 1) { $nav_menu_container.prepend('There were no galleries that matched your search'); } //$("#left-sidebar").removeClass('loading'); } function filterList(author) { var input, filter, ul, li, a, i, txtValue; input = document.getElementById('filter-' + (author ? "authors" : "series")); filter = normalize(input.value.toUpperCase()); ul = document.getElementById("list-" + (author ? "authors" : "series")); li = ul.getElementsByTagName('li'); if(filter == '') { $('.filter-series-hide').fadeIn('fast'); } else { $('.filter-series-hide').fadeOut('fast'); } // Loop through all list items, and hide those who don't match the search query for (i = 0; i < li.length; i++) { a = li[i].getElementsByTagName("a")[0]; txtValue = a.textContent || a.innerText; txtValue = normalize(txtValue); if (txtValue.toUpperCase().indexOf(filter) > -1) { li[i].style.display = ""; } else { li[i].style.display = "none"; } } }var use_3dsecure = false; //extended jquery functions always in use globally $.fn.extend({ /********************************************************** * Placeholder replacement for older browsers * TODO: Remove this when we drop support for IE8 * @return void **********************************************************/ placeholder: function() { $(this).find('input[type="text"], input[type="password"], textarea').each(function(ev){ var placeholder = $(this).attr("placeholder"); var is_textarea = $(this).is("textarea"); if(typeof placeholder !== "undefined" && placeholder != "" && ($(this).val() == "") || (is_textarea && $(this).text() == "")) { $t = $(this); $t.addClass('hasPlaceholder'); $t.attr("value", placeholder); $t.bind("focus", function(){ if( this.value == placeholder ) this.value = ""; }); $t.bind("blur", function(){ if( this.value == "" ) this.value = placeholder; }); $(this).parents("form:first").submit(function(){ var _t = $(this).find('.hasPlaceholder'); if( _t.val() == placeholder ) _t.val(""); }); } }); }, /********************************************************** * Clear form of all data * TODO: Remove need for global.js clearForm() * @return void **********************************************************/ clearForm: function(){ this.each(function() { $(this).click(function() { var form = this; while (form.nodeName != "FORM" && form.parentNode) { form = form.parentNode; } clearForm(form); with(form){ if(typeof recordsLength !== 'undefined') recordsLength.selectedIndex = 1; if(typeof kwconj !== 'undefined') kwconj[0].checked = true; } $(form).parent().find('.alert').remove(); }); }); }, /********************************************************** * Allow alerts to show/hide depending on user cookie * @param string key The key to use for the cookie * @return void **********************************************************/ alert_cookie: function(key) { this.each(function() { //if key is not passed we'll just use default global message key = key || 'global_message'; //setup cookie if this is first time for user if(typeof $.cookie(key) == "undefined") $.cookie(key,'open',{path:'/'}); //when we close the alert, set the cookie to closed for other interactions $alert = $(this).find('.alert'); $alert.bind('closed.bs.alert', function () { $.cookie(key, 'closed',{path:'/'}); }); }); }, /********************************************************** * Gets the natural width and height for an image * @return object Has two keys width and height **********************************************************/ real_size: function() { var $img = $(this); if ($img.prop('naturalWidth') == undefined) { var $tmpImg = $('').attr('src', $img.attr('src')); $img.prop('naturalWidth', $tmpImg[0].width); $img.prop('naturalHeight', $tmpImg[0].height); } return { width: $img.prop('naturalWidth'), height: $img.prop('naturalHeight') }; }, ajax_template: function(data, callback) { var $_this = $(this); if(data !== null) { //only get parameters allowed by our application var params = JSON.stringify(data, allowed_tpl_ajax_data); data.tpl_action = data.tpl_action || 'html'; $.ajax({ type: "POST", url: "/manager/include/ajax_call.php", data: "a_func=pkd_get_template&a_params="+data.tpl+"|"+params, success: function (response) { switch(data.tpl_action) { case 'append': $_this.append(response); break; case 'prepend': $_this.prepend(response); break; default: $_this.html(response); } }, error: function(jqXHR, textStatus, error) { if ( window.console && console.log ) console.log('[ajax_template] [' + textStatus + '] '+(error != '' ? '['+error+'] ' : '') + general_ajax_error); $_this.html('
'+general_ajax_error+''); }, complete: function() { //setup callback for finished request if ( $.isFunction(callback) ) { callback.call({ data:data }); } } }); } else { //setup callback for finished request if ( $.isFunction(callback) ) { callback.call(); } } }, //Counts down the number of remaining characters left countCharValidation: function (num, selector) { this.each(function () { var chars = "", charCount = 0; $(selector).text(num); chars = $(this).val(); var $remaining_chars = $(this).parent().find(selector); $(this).keyup(function () { chars = $(this).val(); $.fn.countChar(chars, num, $remaining_chars); }); $.fn.countChar(chars, num, $remaining_chars); }); }, countChar: function (str, num, selector) { str = $.trim(str); var charCount = (str == "" ? 0 : str.length); var remaing = num - parseInt(charCount); $(selector).text(remaing); } }); function escapeHtml(str){ var entityMap = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''', '/': '/', '`': '`', '=': '=' }; return String(str).replace(/[&<>"'`=\/]/g, function (s) { return entityMap[s]; }); } /** * Intl.NumberFormat as currencyFormatter * Creates a proper price out of the entered amount. * */ const currencyFormatter = new Intl.NumberFormat(pkd_loc.currency_loc, { style: 'currency', currency: pkd_loc.currency, minimumFractionDigits: 2 }); /** * Number.prototype.truncateToDecimals(dec) * Truncates a number to only two decimal places without rounding * Should do validation before using this function * * @param integer dec: length of decimal * */ Number.prototype.truncateToDecimals = function(dec) { var dec = dec || 2; var regex = /\./g; var num_str = this.toString(); if(num_str.match(regex)) { // we have a number with a decimal const calcDec = Math.pow(10, dec); return Math.trunc(this * calcDec) / calcDec; } else { return this.toFixed(dec); } }; $(function(){ //bootstrap $.fn.button.Constructor.DEFAULTS = { loadingText: 'Loading...' } if (!("placeholder" in document.createElement("input"))) $("form").placeholder(); if($('#pkd_locale').length > 0) { $('#pkd_locale').selectpicker({style: 'btn-link'}); $('#pkd_locale').on('change', function (e) { var url = $(this).find("option:selected").data('target') || ''; if(url != '') { try { window.location.replace(url); } catch (e) { window.location = url; } } }); } //setup lightbox in gallery mode magnific_popup_config.type = 'image'; magnific_popup_config.zoom = { enabled: true, opener: function(openerElement) { //if the opener element is an image than use that to zoom //else if there is no image inside the openerElement than find the image up a couple parents(used for detail page) return (openerElement.is('img') ? openerElement : (openerElement.find('img').length > 0 ? openerElement.find('img') : openerElement.parent().parent().find('img'))); } }; magnific_popup_config.gallery = { enabled:true }; magnific_popup_config.image.markup = ''; magnific_popup_config.image.titleSrc = custom_title_src; magnific_popup_config.callbacks = { open: function() { $self = this; if($self.wrap.find('.mfp-figure').css('position') != 'static') { boxed_enabled = true; } $img = $self.wrap.find('.mfp-img'); $self.wrap.on('click', '.mfp-enlarge-link', function() { $self.wrap.toggleClass('mfp-enlarged'); if($self.wrap.hasClass('mfp-enlarged')) { last_max_height = $img.css('max-height'); $img.css('max-height', 'none'); } else { $img.css('max-height', last_max_height); } }); }, beforeClose: function() { if(enlarge_enabled) { this.wrap.off('click', '.mfp-enlarge-link'); this.wrap.removeClass('mfp-enlarged'); } }, change: function() { if(boxed_enabled) { $.magnificPopup.instance.resizeImage.call(this); } }, imageLoadComplete: function() { $self = this; if(boxed_enabled) { $.magnificPopup.instance.resizeImage.call(this); } if($self.wrap.find('.mfp-enlarge').is(':visible')) { enlarge_enabled = true; } if(enlarge_enabled) { $self.wrap.removeClass('mfp-enlarged'); $img = $self.wrap.find('.mfp-img'); var img_size = $img.real_size(); if(img_size.width <= $img.width() ) { $self.wrap.find(".mfp-enlarge").hide(); } else { $self.wrap.find(".mfp-enlarge").show(); } } } }; $('.lightbox').magnificPopup(magnific_popup_config); $.magnificPopup.instance.resizeImage = function() { var mfp = $.magnificPopup.instance; var item = mfp.currItem; if(!item || !item.img) return; if(mfp.st.image.verticalFit) { var decr = 0; // fix box-sizing in ie7/8 if(mfp.isLowIE) { decr = parseInt(item.img.css('padding-top'), 10) + parseInt(item.img.css('padding-bottom'),10); } var maxHeight = (mfp.wH-decr); if(boxed_enabled) { var bottomBarHeight = ( $('.mfp-title').outerHeight(true) + ($('.mfp-bottom-bar').outerHeight(true) - $('.mfp-bottom-bar').height() ) ); var mfpFigure = $('.mfp-figure'); maxHeight = maxHeight - ( ( (mfpFigure.outerHeight(true) - mfpFigure.height() ) + bottomBarHeight ) ); } item.img.css('max-height', maxHeight); } }; //setup sharing tooltips $('.share-icon').tooltip(); $('.st_sharethis span').tooltip(); //toggle login layer $(".topic-notification-login").on('click', function(){ $_tn_login_ele = $('.topic-notification-list-login-hide'); $_tn_login_ele.parent().toggleClass('open'); $_tn_login_ele.slideToggle(); }); //setup popovers for shipping links on order detail if($(".ship-link-popover").length > 0 ) { $(".ship-link-popover").each(function(){ var popover_html = $(this).next().html(); var options = { html:true, content:popover_html, placement:'auto' }; $(this).popover(options); }); } //setup of getting number of cart items ajax $.ajax({ type: "POST", url: "/manager/include/ajax_call.php", data: "a_func=checkCart&a_params=true", success: function (data) { var cart = jQuery.parseJSON(data); $cart_num_obj = $(".cartNumItems"); var cart_num_str = cart.numitems.toString(); var cart_text = cart_item_label_plural; if (cart.numitems == 1) cart_text = cart_item_label; // singular case when 1 var cart_num_html = cart_text.replace(/\%d/g, cart_num_str); $cart_num_obj.html(cart_num_html); if (cart.numitems > 0) $cart_num_obj.addClass('active'); else $cart_num_obj.removeClass('active'); } }); $('a[rel="external"]').on('click', function(e) { e.preventDefault(); window.open( $(this).attr('href') ); }); if( $(".clearForm").length > 0 ) { $(".clearForm").clearForm(); } // see if referrer is a page within site if($("#backHistory").length > 0) { if(document.referrer.indexOf(window.location.hostname) != -1) $('#backHistory').show(); else $('#backHistory').hide(); } //setup global namespace for modals if($('#coupon_rules_modal').length > 0) modals.coupon = $('#coupon_rules_modal'); if($('#cvv_modal').length > 0) modals.cvv = $('#cvv_modal'); if($('#print_modal').length > 0) modals.print = $('#print_modal'); if($('#order_history_modal').length > 0) { modals.orderhistory = $('#order_history_modal'); modals.orderhistory.on('hide.bs.modal', function () { $(this).removeData('bs.modal'); }); } if($('#lang_modal').length > 0) { modals.lang = $('#lang_modal'); modals.lang.on('hide.bs.modal', function () { $('#modal-response-lang').html(''); }); $('#pkd_locale_preferred').selectpicker(); $('.pkd-locale-preferred-dropdown .btn').append(''); $("#pkd_locale_preferred").on('change', function(e){ var val = $(this).val(); //only get parameters allowed by our application if(val != '') { var $icon = $(".pkd-locale-preferred-dropdown").find('.fa'); var $response = $('#modal-response-lang'); $icon.css('display', 'inline-block'); $(this).prop('disabled', true); $.ajax({ type: "POST", url: "/manager/include/ajax_call.php", data: "a_func="+ajax_registered_calls.setpreferredlocale+"&a_params="+val+"|", success: function (response) { $response.html(response); }, error: function(jqXHR, textStatus, error) { if ( window.console && console.log ) console.log('[set_preferred_locale] [' + textStatus + '] '+(error != '' ? '['+error+'] ' : '') + general_ajax_error); $response.html(''+general_ajax_error+''); }, complete: function(){ $("#pkd_locale_preferred").prop('disabled', false); $icon.css('display', 'none'); } }); } }); } /* Setup Topic Notification */ if($('#lyr-topic').length > 0) { modals.topics = $('#lyr-topic'); modals.topics.on('hide.bs.modal', function (e) { window.location.hash = ""; }); } $('.topic-notification-link').on('click', function(e){ $opener = $(this); append_tn_modal(); e.preventDefault(); if( $opener.hasClass("mobile") && $opener.data('mobile') != '' ) { window.location = $opener.data('mobile'); } else if( ! $.isEmptyObject(modals.topics) ) { modals.topics.modal('show'); //set hash to topics if(!window.location.hash) { window.location.hash = "topics"; } if($(".widget_el_email_wrap_loggedin").length > 0) { var url = $(".widget_el_email_wrap_loggedin a").attr("href"); if(url.indexOf("topics") == "-1") $(".widget_el_email_wrap_loggedin a").attr("href", url+"#topics"); } } }); //if we have a hash tag if(window.location.hash) { switch(window.location.hash) { //when hash is topics then open topic modal case "#topics": append_tn_modal(); if( ! $.isEmptyObject(modals.topics) ) { modals.topics.modal('show'); } break; } } $('.want-link-remove').on('click', function(e){ e.preventDefault(); if(confirm(wish_remove_confirm)){ window.location=$(this).attr('href'); } }); $(document).on('click', '.mock-anchor', function(e) { var url = $(this).data('url') || ''; var target = $(this).data('url-target') || ''; if($.trim(url) != '') { if($.trim(target) == '') { window.location = url; } else { window.open(url,target); } } }); if($('.flex-form').length > 0) { $(".flex-form-link").on('click', function(e){ e.preventDefault(); var target = $(this).attr('href'); //show flex form layer $(target).addClass('display-flex'); //flex layer no longer hidden to user $(target).attr('aria-hidden', 'false'); //keyup event for closing the popup once opened $(document).keyup(function(e) { // esc to close flex form if (e.keyCode === 27) $(target).trigger('click'); }); //wait a short very brief moment to show the form setTimeout(function(){ //make form active and visible $(target).find('.flex-form-inner').addClass('active'); //focus on first element var $form = $(target).find('form'); $form.find("input[type!='hidden'],select,textarea").first().focus(); }, 50); }); $('.flex-form').on('click', function(e) { //hide the form and form layer $(this).removeClass('display-flex').attr('aria-hidden', 'true'); $(this).find(".flex-form-inner").removeClass('active'); //unbind esc keyup event $(document).off('keyup'); }); $(".flex-form form").each(function(idx,obj){ $(this).addClass('is-flex'); $(this).on('click', function(e){ //allow you to click inside the form without closing the layer e.stopPropagation(); }); }); } /* Fix for Accessibilty */ $('.btn-group-fix .btn').on('click', function(){ $parent = $(this).parent(); $parent.find('input').prop('checked', false); $(this).next().prop('checked',true); $(this).closest('form').submit(); }); /* //code that was doing hover search $('#utils-search [type="submit"]').on('click', function(e){ if($('#utils-search').hasClass('active')) { return true; } $("#utils-search").addClass('active'); $("#utils-search").find('.form-control').focus(); return false; }); $("#utils-search").on('mouseover mouseout', function(e){ if(e.type == 'mouseover') { $(this).addClass('active'); $(this).find('.form-control').focus(); } else { $(this).removeClass('active'); $(this).find('.form-control').blur(); } if($("#utils-account").hasClass('open')) { $("#utils-account").removeClass('open'); } }); //Code to handle UI for bootstrap dropdrown hover if($('[data-hover="dropdown"]').length > 0) { var t; $('[data-hover="dropdown"]').on('mouseover mouseout', function (event) { var $dropmenu_parent = $(this).parent(); if ($dropmenu_parent.hasClass('touch-open')) return true; var $dropmenu = $dropmenu_parent.find('.dropdown-menu'); var timeout = $(this).data('delay') || 1000; if (event.type == 'mouseover') { if(!$dropmenu.hasClass('open') && !$(this).is(event.target)) { // stop this event, stop executing any code // in this callback but continue to propagate return true; } $dropmenu.show(); $dropmenu_parent.addClass('open'); } else { t = setTimeout(function () { $dropmenu.hide(); $dropmenu_parent.removeClass('open'); }, timeout); $dropmenu.on('mouseenter', function () { $dropmenu.show(); $dropmenu_parent.addClass('open'); clearTimeout(t); }).on('mouseleave', function () { $dropmenu.hide(); $dropmenu_parent.removeClass('open'); }); } }); $('[data-hover="dropdown"]').on('click', function (event) { var $dropmenu_parent = $(this).parent(); if ($dropmenu_parent.hasClass('touch-open')) return true; if ($dropmenu_parent.hasClass('open')) { event.stopImmediatePropagation(); event.stopPropagation(); event.preventDefault(); return false; } }); $('[data-hover="dropdown"]').on('touchstart', function (event) { var $dropmenu_parent = $(this).parent(); $dropmenu_parent.addClass('touch-open'); }); $('[data-hover="dropdown"]').on('show.bs.dropdown', function () { var $dropmenu_parent = $(this).parent(); $dropmenu_parent.addClass('open'); }); $('[data-hover="dropdown"]').on('hide.bs.dropdown', function () { var $dropmenu_parent = $(this).parent(); $dropmenu_parent.removeClass('touch-open'); $dropmenu_parent.removeClass('open'); clearTimeout(t); }); }*/ });